DEV Community

Will Vincent for Learn Django

Posted on • Updated on • Originally published at learndjango.com

Essential Django 3rd Party Packages

Django relies heavily on its ecosystem of third-party packages which add additional functionality to the framework. But since there are over 3,000 available--which you can search on the lovely Django Packages website--navigating all of them can be overwhelming.

I recently wrote a post on the Top 10 Most Popular Django packages and there's a lively discussion on the official Django forum around Top 5 3rd party packages as well. But here is my current list of must-have Django packages that I reach to for almost every new project.

Django Utilities

django-debug-toolbar
Local debugging of queries, viewing requests and responses, and more.

django-extensions
Custom extensions including shell_plus to automatically load models into the shell and runserver_plus among many others.

django-environ
Important information should be stored in environment variables, not in source code. This includes your SECRET_KEY, any API keys, database credentials, payment info, and so on.

django-crispy-forms
The best way to have DRY (Don't Repeat Yourself) forms.

django-filter
An improved way to filter Django QuerySets based on user selections.

django-allauth
A host of improvements to Django's minimal user registration defaults. Includes support for social authentication, email-only login, and many more features.

django-redis
Redis support for Django.

django-q
A task queue that supports Redis, Disque, and several others.

django-compressor
Compresses JavaScript and CSS into a single cached file.

django-silk
Live profiling and inspection of HTTP requests and database queries.

APIs

djangorestframework
With a small amount of code, any existing Django project can be transformed into a REST API. A truly amazing package and used in most larger Django projects that rely on a dedicated JavaScript front-end.

django-cors-headers
If your backend and frontend are hosted on different sites, which is often the case, you need to manage your CORS Headers. This elegant package handles that for you.

djangorestframework_simplejwt
If you want to use JWTs in your API, this is the current go-to package.

Images

django-storages
Are you handling user-uploaded content, commonly referred to as media in the Django world? Or maybe using a dedicated CDN like S3? django-storages has you covered with support for multiple storage providers.

sorl-thumbnail
Thumbnails and image resizing.

Testing

pytest-django
Testing is important and on most projects you'll reach for pytest to improve your testing suite. This plugin provides easy integration.

django_coverage_plugin
A plugin for adding coverage.py to measure Django template execution.

model-bakery
A smart way to create fixtures for testing. Previously named Model Mommy.

Python packages

black
An uncompromising Python code formatter.

coverage
Code coverage measurement.

factory-boy
Improved fixture testing for Python.

pytest
A framework for writing small, modular tests.

Pillow
The Python Imaging Library.

gunicorn
A production Python WSGI server.

pyscopg2-binary
A PostgreSQL database adapter for Python.

whitenoise
The default way to host static files in production for Python.

If you'd like to see even more curated packages, take a look at the awesome-django repo.

Top comments (5)

Collapse
 
patryktech profile image
Patryk

I'd recommend Ariadne instead of Django Rest Framework, if you're just getting into APIs.

DRF is wonderful, stable, and well supported, but GraphQL is amazing and I'd much rather use that than REST APIs, in most cases. I feel like it's the future. Learning both isn't really a problem, but at least do compare the two before starting a new project.

There's also Graphene, which may be useful, but I really don't like the excessive multiple inheritance. The code feels very difficult to decipher and extend. If you want something extensible, Ariadne feels nicer to me.

Collapse
 
wsvincent profile image
Will Vincent

I agree that GraphQL is super promising and when it works, it really works. But when I last looked, it was still pretty earlier days in terms of Django support--lots of non-minor issues cropped up.

That said, GraphQL may well be the future (hard to say) but REST isn't going anyway any time soon. This is my personal list so perhaps if I have occasion to use GraphQL professionally in the near future, I'll add more packages :)

Collapse
 
patryktech profile image
Patryk • Edited

Yup. Key phrases: "if you're just getting into APIs" and "compare the two."

I've worked with both, and GraphQL is more pleasant to me. Single endpoint, no under/over fetching, etc.

Doesn't mean that everyone should rewrite the apps that are already running, but when I start a new app, Ariadne is my go-to now. Worth a look at least.

And the DRF is fantastic, with many pros as well.

Collapse
 
bemmio profile image
Edward Mike

Wow

Collapse
 
adwaitthattey profile image
Adwait Thattey

django-widget-tweaks would also be a good addition.