Six Big Open-Source Django Codebases to Read and Learn From
You have been reading books and tutorials about Django - but it feels like something’s missing. How do these pieces come together in the real world? What’s different, and what can you learn from it?
There’s also a lot you can get out of exploring other people’s projects. Tools, (missing) best practices, code structure and a glimpse of real-world issues. Everything is there to be looked at, and to help you level up.
Here are six open-source codebases, built in Django, which you can read and learn from.
Django “RealWorld” Example App
Let’s start with the “real-world” app. It’s part of a really cool project!
The RealWorld project specifies an API, and there are implementation of both API clients and API servers in many languages and frameworks. The complete picture, is supposed to be a “medium.com clone”.
The Django “RealWorld” app, is an implementation of the server-side API. This project uses Django Rest Framework, and a few other packages to make developing an API a smooth experience. You can check the code out here.
By the way: wanna learn more about Django packages? Check out this list of my favorite Django packages in 2019.
There are a few things which make this project different compared to actively maintained codebases. The app was last changed 3 years ago, it’s “done” and not in use and constant development. There’re also no traces of deployment in the repo.
Still, a nice project to have a look at if you’re interested in RESTful APIs.
The Django packages site lists almost all projects which exist around Django. You should check it out if you don’t know it yet! The project repository can be found on GitHub.
This is a real-world project - as real as it gets. The authors knows it’s not perfect, and would love to change a few things but real-life constraints get in the way. Check out this recent comment by one of the authors for some background knowledge:
“[…] Please be careful using that project as an example of how to build a Django project. Some reasons off the top of my head […]”
This is the real deal. It is imperfect, and has been written by people who were learning, and has been around for 8 years. Then it was through a major refactor and the original authors are still not happy with it but it’s good enough. Just like almost all legacy projects.
Saleor isn’t a Django web app project, but a nice codebase related to Django. It’s a “GraphQL-first e-commerce platform”. You can check out the code on GitHub.
I find this project really interesting, because it’s the new cool kid in a very exciting area (e-commerce). The tech stack they chose should be relevant to most people who are interested in combining Django with React (or other JS frameworkas) and GraphQL. Very cool!
Wagtail is a CMS built on top of Django. As with Saleor, this is not a web app project, but a very cool codebase! You can check it out on GitHub.
One thing I found really interesting here, was the use of developer tooling around the project. Check out all the non-Django specific files in the repository root, and try to find out what they are used for :)
Open EdX is built using Django! It’s also the software which powers edX. This is a big, and pretty well-aged project. You can find it on GitHub.
While you won’t see anything specific to the actual edX site here, you can learn a lot about collaboration and writing extensive documentation. Among others, the project uses Webpack and Docker. Check out the Makefile for an overview of basic tasks around the project.
Taiga is a project management platform, written in Django. Once again, you can find the code on GitHub.
The API docs are located in their own repository. The frontend part of the project is written in AngularJS, and is also clearly separated from the backend.
Last but not least, Django’s own website is powered by (you guessed it) Django. The repository is online on GitHub.
As with most things Django, this project is exceptionally well documented! You can find clear instructions on setting up a development environment and frequent development tasks. Inside the repo, there are all the components of the deployment process, and tooling around the final deployed application. The Makefile and the Procfile are nice places to start your exploration.
Want to find more projects?
The six repositories above should be plenty to help you learn more about real-world, big Django codebases and how they are structured.
Even if you only take a little time to explore one of them, I’m sure you’ll be able to spot a lot of interesting details which will help to guide your practical learning efforts.
If you want to find more Django projects in the wild, check out the methods I outlined here. Happy reading! Got one more cool project you’d like to contribute? Let me know via Twitter.