How to Learn Django (2020)

Will Vincent - Jun 21 '20 - - Dev Community

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.

HTML/CSS

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, and in companies Django developers 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.

Python

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.

Git

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.

Django Tutorials

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 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.

Books

For a book-length treatment, Django for Beginners and Django Crash Course are friendly beginner treatments. For intermediate/advanced coverage, Two Scoops of Django, Django for Professionals(https://djangoforprofessionals.com), and Speed Up Your Django Tests are recommended.

Videos

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.

Podcasts

At the moment, there is only one weekly podcast on Django called Django Chat, hosted by the creator of LearnDjango.com and a Django Fellow, Carlton Gibson. Django Riffs is a budding series and Running in Production often features Django-specific content.

Conferences & Meetups

The best way to learn more and become involved in the community is to attend either a DjangoCon or local Meetup. DjangoCon US has been delayed until 2021 although DjangoCon Africa is scheduled for November, and both DjangoConEurope and PyCon Australia are holding virtual conferences. In addition, there are Django meetups in most major cities that meet monthly and even, these days, virtually.

Django Forum

If you’re stuck on a Django issue, Stack Overflow is always an option but a newer one is the official Django Forum which has a wealth of good advice from experts in the community.

Conclusion

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 9 months, there’s never been a better time to learn Django.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .