20 Django Packages That I Use in Every Project

Django is a "batteries-included" web framework that provides most of your needs to build complex web applications. But its real strength lies in the larger Django ecosystem of third-party packages that go above and beyond what's offered in "core" to provide additional functionality.

There are thousands of third-party packages at this point, and if you are new to Django, it can be overwhelming to make sense of it all. The Django Packages website is a good resource for discovering new tools, and Awesome Django provides a more curated list.

This article highlights my personal favorites that I reach for in almost every new Django project. They saved me a ton of time, and I hope the list does the same for you.

Django REST Framework

With Django REST Framework (DRF) you can transform an existing Django site into a REST API with very little code. It purposefully mimics many Django conventions and provides robust serialization so you can format your data as you choose. A large community actively maintains the package, with its ecosystem of related third-party packages.

If forced to pick only one third-party package, most Django developers would select DRF. It is that important. In recent years, django-ninja has emerged as a competing approach that is performant and async-ready but requires type hints.

django-debug-toolbar

Django does ship with a Debug mode, but django-debug-toolbar takes it to the next level, providing a configurable set of panels to inspect all areas of a website, including SQL queries, requests and responses, and general performance insights. This package has been around since the beginning of Django and is a mainstay of modern Django development.

django-allauth

Django's built-in authentication system is powerful, but `django-allauth`` takes it to another level. It adds many improvements to Django's registration defaults, including social authentication, email-only login, and more. I use it in every Django project.

django-extensions

This package is a Swiss Army watch of valuable additions to Django. There is a long list of command extensions available, but particular favorites are shell_plus for autoloading database models in the Python shell and runserver_plus for an improved local web server powered by Werkzeug.

django-cors-headers

If you are building an API with Django, you'll need a way to add Cross-Origin Resource Sharing (CORS) headers to responses. This package handles that issue seamlessly and elegantly.

environs

Environment variables are a necessary part of modern web development, allowing developers to keep private information such as your SECRET_KEY, API keys, database credentials, payment info, and more private.

I prefer environs and specifically its usage with Django, but other popular options in the community include django-environ and python-dotenv.

django-anymail

Sending emails can be tricky, but it is a core part of any user registration process or notifications. This package makes it almost easy by seamlessly integrating with the most popular email service providers, including Amazon SES, MailGun, SendGrid, and more.

django-filter

An improved way to filter Django QuerySets based on user selections. It also has robust support for adding filters to Django REST Framework.

django-storages

Are you handling user-uploaded content, commonly called "media, " in Django? Or use a dedicated CDN like S3 for your static files? django-storages has you covered with support for multiple storage providers, including Amazon S3, Azure Storage, Digital Ocean, Google Cloud Storage, and more.

Pillow

If you are working with images--user profile pics, image uploads, thumbnails, etc--then you'll likely need to add Pillow, which works alongside Django's ImageField.

django-crispy-forms

controls the rendering behavior of your Django forms in an elegant and DRY (Don't Repeat Yourself) way. It also comes with template packs for popular CSS frameworks like Tailwind, Bootstrap, Bulma, Foundation, and Uni-form.

django-q2

Task queues manage background tasks that are time-consuming or resource-intensive, such as sending emails, processing data, long-running tasks, and so on.

Although Celery is a popular option, I prefer django-q2 given it is simpler, more tightly integrated with Django, and uses the Django ORM for scheduling tasks and storing results.

Wagtail CMS

Wagtail is an excellent choice if you want a customizable content management system (CMS) built in Python. Maintained by the development team at Torchbox, Wagtail has its own ecosystem of third-party packages, conferences and a large community providing new features and releases.

pytest-django

Although Django comes with built-in testing tools, pytest and specifically the pytest-django plugin are widely used in the community.

pytest-cov

Coverage is the widely used tool for measuring code coverage in a project, and the pytest-cov plugin integrates seamlessly with pytest.

model-bakery

Model Bakery offers a smart way to create fixtures for testing in Django. You can create many objects with a single line of code, saving tons and tons of developer time.

whitenoise

Websites need a way to serve static files, and in the Python ecosystem, the default choice is WhiteNoise. With a couple of lines of configuration, WhiteNoise transforms your static files into a self-contained unit that can be deployed anywhere without relying on nginx, Amazon S3, or any other external service.

gunicorn

gunicorn is one of the most popular WSGI-based servers for Python that is straightforward to use and get going but has enough configuration options to tweak things when necessary. It is simple enough to configure in a few minutes but powerful enough to be used by Instagram, even when they could have chosen other WSGI options like uwsgi or Apache/mod_wsgi.

psycopg

If you are working with a PostgreSQL database--and many Django developers do--then psycopg is the database adapter you need for production. psycopg was recently updated to version 3.0 and is faster than ever.

Black

Black is a Python code formatter that is more or less the default in the Django community. Integrating it into your workflow will save time and produce more readable code for you and your colleagues.

Conclusion

I reach for these twenty third-party packages in almost every new project, but there are so many more to explore. If you want to read more, check out the active discussion on the official Django forum. And if you want to learn how to build real-world Django projects, check out my book Django for Beginners.

Join My Newsletter

Subscribe to get the latest tutorials/writings by email.

    No spam. Unsubscribe at any time.