Django from first principles, part 20
MP 119: How do you keep learning about Django?
Note: This is the 20th (and final) post in a series about building a full Django project, starting with a single file. This series is free to everyone, as soon as each post comes out.
This was a much longer series than I originally imagined. I was working at the DjangoCon US 2023 sprints, when Paolo Melchiorre hooked his laptop up to a TV to show everyone an even shorter single-file Hello World Django project than others had previously posted. After Paolo's demonstration, I ended up in a conversation with Andrew Mshar about the potential benefits of using these single-file projects to help people understand Django better. We both agreed it would be interesting to show people how to start with one of these tiny projects and build out a standard Django project, one step at a time.
Andrew ended up writing a blog post about how you might go from a tiny single-page project to a full real-world project. That was good, but I told him I wanted to see someone write a series that would show all the steps from that first single file to a full project. This series is the result of that conversation.
If you've read through this whole series, where do you go to keep learning about Django? It turns out there's a rich world of Django resources out there, if you just know where to look. In this final post, I'll run through a number of ways you can learn more about Django, and keep up with all the people and developments in the Django world.
Starting a new Django project
When you're starting a new project, I recommend starting with the standard startproject
and startapp
commands. For example, starting the BlogMaker Lite project would look something like this:
$ mkdir bmlite_project $ cd bmlite_project $ python -m venv .venv $ source .venv/bin/activate (.venv)$ pip install django (.venv)$ django-admin startproject blogmaker_lite . (.venv)$ python manage.py startapp blogs
This will generate a structure quite similar to what we ended up with in this series:
$ tree -L 3 ├── blogmaker_lite │ ├── asgi.py │ ├── settings.py │ ├── urls.py │ └── wsgi.py ├── blogs │ ├── admin.py │ ├── apps.py │ ├── migrations │ ├── models.py │ ├── tests.py │ └── views.py └── manage.py
Hopefully, seeing these files and directories at the start of a project is less confusing after reading through this series. Even if you're not using all these files right away, it's nice to have this structure in place as your project begins to grow.
Starting from a single file
If you're building a really small project and like the idea of working from a single file, I suggest taking a look at the relatively new nanodjango project. This project provides a clean way to build and run a site from a single file, but also provides a clear path for converting your project to a standard Django project when necessary. When your project outgrows the single-file approach, you can issue the convert
command:
$ nanodjango convert blogmaker_lite.py /.../projects/blm_project --name=blogmaker_lite
I would love to see nanodjango continue to evolve. I've seen a number of single-file frameworks attempted, but this is the first I've seen that offers a way to convert to a full Django project without a bunch of manual work. I think many projects that start as a single file could easily reach a point where this kind of conversion is necessary, and having a built-in way to do that conversion is really helpful. Not only is it easier to do the conversion, it also avoids all the bugs that will inevitably arise from everyone trying to handle that conversion manually.
Richard Terry, the creator of nanodjango, gave a lightning talk at DjangoCon US last month. I'll share a link to his talk once the video is posted.
Starting from a single folder
Carlton Gibson is a great person to follow in the Django community. Carlton was a Django Fellow for five years, meaning he was one of the few people paid to help maintain Django. In 2019 Carlton gave a talk that reignited some of the community's thinking around single-file approaches.
But Carlton has a more practical take on small Django projects. When starting a new project, he often starts with everything in a single folder. This is a nice way to have everything in one place, without the constraints of trying to cram all your code into one file. Carlton shared a concise writeup of the approach a while back, and it's well worth your time to read through that article.
Django-cookiecutter
The django-cookiecutter tool is a template for starting Django projects, which gives you more than what the default startproject
and startapp
commands offer. I haven't used it myself, but I know many people who have. If you're going to build new projects on a regular basis, or want to start a project with a lot of resources already built-in, have a look at this tool and see if it fits your use case.
The official Django tutorial
Unless you're a really experienced Django developer, I highly recommend running through the official Django tutorial. The tutorial walks people through building an app for making online polls. It touches on the request-response cycle, models, views, templates, forms, tests, and much more.
Working through the tutorial is beneficial in a number of ways. For one thing, it covers many different parts of Django. Even if you've built some real-world Django projects, there's a fair chance the tutorial will highlight some parts of Django that you've never used, and probably didn't even know existed. It will also give you a common background on Django with everyone else who's gone through the tutorial. And finally, you'll probably come away with some opinions about how to best teach people Django. That's a good thing; there's no one way to teach people about Django, and the more people we have thinking about this, the better off we'll all be.
Keeping up with Django
Django is one of the most stable web frameworks around, but it's also been under constant development since it was first released to the public. If you're using Django on a regular basis, or interested in following its development, there are a number of important resources you should be aware of.
Django News
Django News is a weekly newsletter about all things Django, curated by Jeff Triplett and Will Vincent. If you skim the newsletter each week, you'll have a better sense of all kinds of things happening in the Django world. You'll see links to interesting articles, new projects from the community, new developments in Django, and more. If you start following the people whose work you see featured, you'll start to know the community better as well.
Jeff works at RevSys, one of the most well-established Django consultancies around. Will wears many hats in the Django world, including having three books to his name. Together, they do a fantastic job of finding and sharing the most meaningful developments in Django each week.
Django Chat
Will also hosts the Django Chat podcast, along with Carlton Gibson who I mentioned earlier. These are bi-weekly deep dives covering a wide range of topics. If you listen on a regular basis you'll start to know the people behind many Django projects, and have a better sense of the different ways people use Django. Will and Carlton have great banter, and you get to know them a bit as people as well as Django developers. They do a great job of bringing out an appropriate amount of each guest's life story as well as their technical work.
Django people
There are too many people worth following in the Django world to list anyone individually, outside people associated with the specific resources discussed in this post. I could include many great people, but I'd also inevitably leave out just as many other interesting people. Instead, I'll encourage you to follow the #django
hashtag on Fosstodon. Even if you're not a Mastodon user, you can still look through the public posts featuring this tag, and follow links to people's work.
If you subscribe to the newsletter or listen to the podcast, pay attention to the people behind the projects that are relevant to your work. Many of these people maintain some kind of online presence, and if you start to follow them you can find yourself participating more in the community as well. It's a really welcoming community, so don't be shy about reaching out to people whose work and interests overlap with your own.
Getting help with Django
The first place I point people to for getting help with Django is the Django Forum. It's quite active, and the forum is filled with people who've used Django in a wide variety of ways. Django is big enough these days that nobody really knows everything about Django. However, if you have a specific question, chances are there's somebody around who has experience in the area that you're asking about.
There are also a couple Django subreddits, Discord and Slack communities. I'm less familiar with each of these, so I won't offer specific links. If you want to share a specific community please leave a comment with a link, and a brief note about how that community is helpful in your work.
Conclusions
Django is a fantastic web framework in its own right. But the people who help maintain Django itself, the people who work on third-party tools, and the people who use it for a wide variety of purposes form a welcoming and interesting community. Going to DjangoCon each fall is one of the highlights of my professional life. If you've become interested in Django the web framework, and Django the community, you're in good company.
There are many ways to learn about Django, and to keep up with ongoing developments in the community. Find the resources, tools, and people that align with your interests, and you'll find your own place in the community as well. We're happy you're here. :)
If you have any questions or feedback as this series comes to a close, please either make a comment or reply to this email. I'll be happy to hear your thoughts, and happy to respond.