Top 10 Django Third-Party Packages
Django is a "batteries-included" web framework, but it really shines with its robust ecosystem of third-party packages that add additional functionality to the framework. There are almost 4,000 available at this point, all of which are viewable on the lovely Django Packages website. However, navigating all of them can be overwhelming.
The awesome-django repo is a curated list of many popular third-party packages, and there's a separate post on The 10 Most-Used Django Packages. On the official Django forum, a lively debate remains around the Top 5 3rd party packages.
But if you're interested in a greatest-hits list, here you go. These are some of the best and most popular Django third-party packages that I reach for in almost every new project.
1. Django REST Framework (DRF)
Django REST Framework (DRF) makes creating a REST API from scratch or adding an API to an existing Django website easy. 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 own ecosystem of related third-party packages.
Most Django developers, if forced to pick only one third-party package, would select DRF. It is that important. And it is also the most downloaded Django third-party package by far.
django-debug-toolbar is included in the local development of almost every Django project. It helps debug Django applications and comes with a configurable set of panels to inspect various areas of a website, including SQL queries, request and responses, and general performance insights. The package has been around since the beginning of Django and is a mainstay of modern Django development.
The true Swiss Army watch of useful additions to Django. There is a long list of command extensions, 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.
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.
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 many more features.
Wagtail is a content management system built on Django that provides flexibility and an excellent user experience. If you need a Python CMS, Wagtail is the go-to option. It has its own Wagtail third-party packages site, conferences, and a fantastic community led by the development team at Torchbox.
An improved way to filter Django QuerySets based on user selections. It also has robust support for adding filters to Django REST Framework.
Are you handling user-uploaded content, commonly called media, in the Django world? Or maybe 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.
Secret information should be stored in environment variables, not in source code, especially your
API keys, database credentials, payment info, and so on. django-environ is the most popular Django-specific option though other popular approaches include python-dotenv and environs.
Sending email is a core part of any user registration process, and this package seamlessly works with the most popular email service providers, including Amazon SES, MailGun, SendGrid, and more.
Additional Third-Party Packages
It's hard to stop at just ten third-party packages. If this list were longer, it would include the following packages, too:
- cookiecutter-django is a framework for jumpstarting production-ready Django projects quickly.
- django_coverage_plugin is a plugin for adding
coverage.pyto measure Django template execution.
- 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.
- dj-database-url uses a
DATABASE_URLenvironment variable to configure your Django application.
- django-redis has some additional features beyond the built-in Redis cache backend support now in Django.
- djangorestframework_simplejwt if you want to use JWTs in your Django API.
- django-silk performs live profiling and inspects HTTP requests and database queries.
- django-simple-history lets you store model history and view/revert changes from the admin site.
- django-upgrade automatically upgrades your Django projects.
- django-waffle is a feature flipper in Django to turn flags on or off.
- django-q is a task queue supporting Redis, Disque, and others.
- djangox is a Django starter project with batteries.
- model-bakery is an intelligent way to create fixtures for testing.
- pytest-django streamlines integrating
pytestinto your Django application.
- sorl-thumbnail provides thumbnails and image resizing.
Many Python packages are critical parts of the Django ecosystem but can be used more broadly. The following is a list of the most commonly used in Django projects:
- black, an uncompromising Python code formatter.
- celery, a distributed task queue.
- coverage for code coverage measurement.
- factory-boy improves fixture testing for Python.
- flake8 is a tool for style guide enforcement.
- gunicorn is a production WSGI server.
- httpx is a next-generation HTTP client, basically the updated version of requests
- isort sorts your imports in a Pythonic way.
- Pillow is the Python Imaging Library.
- psycopg is a PostgreSQL database adapter for Python.
- pytest is a framework for writing small, modular tests.
- whitenoise is the default way to host static files in production for Django.