Part 3: Learning as I go: building a Django workspace with Lando

Hardy PottingerHardy Pottinger
2 min read

Here’s a workspace I put together recently to help me learn Django:

When you first crank it up, it probably won’t do much of anything. You’ll need to follow along with the Django Tutorial to get your feet wet. Here’s what you get when you run lando start: a Python appserver, with Django installed, and a PostgreSQL database.

You’ll be learning as you go. You will find these Lando tooling commands helpful:

lando django-admin

runs arbitrary django-admin commands on the appserver

lando python

runs python commands on the appserver

lando logs -f

lets you follow the logs of the appserver and database

lando psql

lets you run the psql client for the Postgresql database

lando db-import filename

lets you import a database dump into the database

lando

shows you all the other Lando commands that are available

lando django-admin check

will attempt to validate your Django project configuration, by far the most helpful command you can run when you’re getting started

I’m sharing this Django seed environment early, because I was asked about it by someone else in the Lando community. I haven’t tested it, though it is based on an environment I have used in the past. I will probably update this article after I get a chance to play with it a bit.

UPDATE:
Oh, yeah, now I remember! The Django tutorial has a bit of a bug. I was meaning to report it and make a PR to fix it. This workspace includes a project which has gone as far as creating a new project, and then creating the polls app. The tutorial directs you to change the site/app/urls.py file, which disables the default home page (with the fun rocket blasting off image). So, the “fix,” which is included in my seed project environment, is to add a path for the root.

Not elegant, but it works. For the record, the tutorial does eventually get around to the topic of home pages.

I feel like I’m dropping you in the deep end of the pool. This environment I’ve made almost works out of the box. There are enough tools at your disposal to get things working. But, you’ll end up reading a lot of docs, and learning a lot about Lando and Django along the way. It’s OK, it’ll be fun. You’ll thank me, I think?

0
Subscribe to my newsletter

Read articles from Hardy Pottinger directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hardy Pottinger
Hardy Pottinger

DSpace Committer, since 2011, and works for the California Digital Library as a Publishing Systems Developer. Currently learning a lot about many different tech stacks, but especially enjoying working with the Janeway scholarly publishing platform. Prior to working for CDL, worked for UCLA Library as a developer on both their services team (back-end stuff), and their applications team (front-end stuff). Keenly interested in DevOps tools, technologies, and cultures. Loves working at home, and will talk your ear off about it.