How to Learn Django (2023)
Note: I gave a version of this tutorial at DjangoCon US 2022. You can see the video here:
As a “batteries-included” web framework, Django comes with a host of built-in features and a correspondingly steep learning curve for newcomers. In this post, I discuss what you need to know before giving Django a proper go and links to recommended resources.
Web pages are made out of HTML and CSS. Knowing how to build and deploy static websites is highly recommended before embarking on an attempt at Django. Fortunately, there are several good free resources available including FreeCodeCamp; Shay How’s Learn to Code HTML & CSS series, and HTML & CSS is Hard.
HTML itself is not that deep a topic. You can learn the basics in a day and master most of you’ll need within a week. CSS is, unfortunately, far more complex. You don’t need to become a CSS expert, but you should know how it interacts with HTML and be able to style your static websites somewhat. In practice, most developers rely on a CSS framework like Bootstrap or Tailwind. Professional Django developers at medium-to-large size companies typically don’t touch the front-end at all, so a basic understanding is all that you need.
World Wide Web
It’s necessary to also have a fundamental understanding of how the World Wide Web actually works. Mozilla has probably the best guide called How the Web works which is part of its larger, and also recommended, Learn Web Development series.
Django is written entirely in the Python programming language so it shouldn’t be surprising that Python knowledge is part of the list of prerequisites. The question, though, is how much Python do you need to know? Obviously the more the better but I would argue you don’t need to be a Python expert to use Django. At a minimum, you should understand how to install Python packages (like Django), use a virtual environment, imports, and classes. RealPython is a popular source of Python tutorials but if you’re looking for a book, Python Crash Course covers the basics and is enough background to embark on Django itself.
Databases & SQL
A database-driven website relies on, well, databases so you should have a basic understanding of how SQL works as well as database design principles. Khan Academy has a free guide to SQL and this site has a Database Design Tutorial for Beginners that is also worth reading to understand primary keys, one-to-many relationships, and database normalization.
When using Django itself, the ORM abstracts away the need to write raw SQL but understanding how databases work becomes increasingly essential as websites grow in size.
The final prerequisite is knowledge of Git, the version control system you’ll use on every project. It’s not technically part of Django but you’ll use it on any serious side or professional project. Github has a Git Handbook that is a good first step. You should understand how to install git on a new repository, make commits, and push/pull code to a remote repository either GitHub, GitLab, or BitBucket most likely.
Finally we come to Django itself whose official docs feature a Start page. The official Polls tutorial is a good place to start but is not a friendly welcome for those new to web development with frameworks. It does not cover how to install Python or deploy your site to the internet, and goes in-depth on some areas of Django itself.
If you find the official tutorial too much, a gentler introduction can be found in the Django Girls tutorial on building and deploying a blog, or the free sample chapters of Django for Beginners which cover the building of three Django sites. Mozilla also has a comprehensive though slightly more advanced guide to Django.
For a book-length treatment I'm obviously somewhat biased as I've written three books on Django: Django for Beginners, Django for APIs, and Django for Professionals. Most Django books I'd place in the intermediate/advanced category though one other beginner-friendly option is A Wedge of Django.
For more advanced books Two Scoops of Django 3.x is a classic. Adam Johnson has written two excellent books, Speed Up Your Django Tests and Speed Up Your Django DX that are well worth reading. There is also Django 4 By Example.
There are many YouTube videos on Django and the quality varies considerably. Solid options include Corey Schafer’s series as well as those by Traversy Media. For a paid option, JustDjango is quality content.
At the moment, there is only one weekly podcast on Django called Django Chat, co-hosted by a Django Software Foundation Member and a Django Fellow. Django Riffs is a budding series and Running in Production, though no longer airing new episodes, has many good ones on Django.
Conferences & Meetups
If you're looking for a weekly dose of Django news, articles, tutorials, and projects to check out make sure to sign up for the free Django News Newsletter.
If you’re stuck on a Django issue, Stack Overflow is always an option but the official Django Forum has a wealth of good advice from experts in the community. I can almost guarantee an answer to your question there and it will likely be much higher quality than Stack Overflow.
Ultimately, learning Django is a constant endeavor. The framework continues to evolve as does the broader World Wide Web, most notably with the current introduction of Async features in Django 3.0+. With a major new release scheduled for every 8 months, there’s never been a better time to learn Django.