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

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

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


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.

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/ 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?