Are you starting a Django project soon? You’re probably wondering whether there are any useful packages out there that could help you out in your projects.
Here’s a list of the most valuable Django packages with links and descriptions to help you get them quickly to work without having to do a lot of research beforehand. All the packages I chose support Python 3 and are in a stable version to help support a wide range of Django projects.
Ready to explore the world of Django packages? Let’s dive in!
But first – is Django a library?
It’s easy to get lost in the world of Python tools because there are so many new frameworks and libraries available in its ecosystem today.
Still, it’s worth to clarify this: Django is not a library, but a framework.
Django is a free, open-source, high-level Python web framework that promotes rapid development and clean design. It was developed by a group of experienced programmers who aimed to remove the hassle of developing web apps and allow teams to focus on writing code without having to reinvent the wheel every time. That means writing fewer lines of code!
Thanks to its incredible speed, high security, flexibility, and scalability, Django quickly gained traction and today is one of the most popular technologies for web development projects in Python.
For those taking their first steps in Django, we recommend this article: What is Django and how to get started?
Modules vs. packages – what are modules in Django?
Modules and packages are sometimes confused with one another, so let’s take a moment to explain the difference before we move on to our list.
A package refers to a collection of Python modules. A module is a single Python file, while a package is a directory of such modules. A package contains an additional __init__.py file to distinguish itself from a mere directory that includes some Python scripts.
In this article, you will find 30 Python built-in modules you should be using in your project. Check if you know them all!
The best Django packages
Note: Since there are several good reasons why coding frontend in Django isn’t the best idea, I decided to focus on packages for backend projects.
- This is a must-have tool for any Django project as it’s key that we stay informed about all the code-based issues in the application.
- Firstly: the package immediately alerts us about all the previously-uncaught exceptions that occurred in production.
- Secondly: we can catch the issue ourselves and send the error information to sentry, adding even more relevant data.
- Building an alert system on our own is definitely non-trivial and debugging without this kind of logs is next to impossible.
That situation when the server throws an error and you don’t have to investigate it.
- It will catch any uncaught exceptions (which means 500 returned from the server with no further information usually) and send us full details about the issue right after it happens.
- When the code is working correctly, the sentry is useful as an alert system to which we can send the errors or logs about any non-normal events.
If you want to write a REST Architectural Constraints API, this package will do that for you – together with proper, auto-generated documentation that supports implementing the package in projects.
No need to write the REST API yourself.
- Creating REST API endpoints for your models will take just a few lines of code.
- Auto-generated documentation is great because it always changes with the endpoints.
You may be interested in this: The Ultimate Django Rest Framework Tutorial
- A set of tools that help with your daily work.
- JSONField was at first introduced in this package before it officially became part of Django 1.9 (for PostgreSQL, of course).
- V See the awesomeness list below V But keep in mind that this repo solves several other problems, I just found them rather boring and uncommon.
Adds a bunch of random useful functionalities.
- command shell_plus runs Django shell with preloaded files, classes, and models that speed up any work with the Django shell.
- More fields that include:
- AutoSlugField – generates a unique slug for given data
- CreationDateTimeField and ModificationDateTimeField – stores the first save to the database and the last DateTime modification.
- Job scheduling with Django! You’ll still need some cron, but having scripts in Django makes it easier to administrate.
You might like this: 6 expert tips for building better Django models
While using DRF for some projects, it’s essential to add some JWT token authorization. That’s exactly what this package is about.
You won’t have to implement and manage the Authentication token for the API on your own.
Provides everything you need for JWT Auth: the login endpoint and Django auth class.
The DRF offers auto-generated documentation – and this package makes the documentation nicer for your projects.
Creates nice documentation out of the DRF API for free.
- Nice auto-documentation for your endpoints.
- It’s easy to document custom endpoints manually.
Any web service that allows uploading and viewing photos needs the thumbnails feature. This package provides it.
All servers hosting images need thumbnails, and this package is the solution.
Configurable thumbnails filed for Django models that automatically generates a smaller version of the uploaded image.
This package keeps a history of record changes. If a client has access to the database through the admin panel, they might change something by mistake or may want to return to the previous version of the text.
Keeps a history of changed rows in the database.
Keeps track of all model changes while setup takes no time.
A simple data export to known file types like CSV or XLS. You can also export data as a fixture to the test server, and this fixture can contain Foreign Keys. The package allows generating graphs in the admin panel as well.
Adds some functions that come in handy during the early stages of developing an app.
Export data from admin panel to XSL, CSV, Fixture.
A set of useful utils for Django models.
Adds some models and fields that already help with some common issues.
MonitorField field that is DateTime field and its update to now() each time the field it’s looking to get updated.
- Allows using any cloud storage services as the default file storage. That becomes important when you want to pass whatever users send us to another storage.
- For example, a user may send us a lot of substantial data like photos, movies, or even backups. To make this data available for them without slowing down the app, it’s a good idea to use cloud storage solutions like Google Cloud.
Using almost any remote storage as the Django default file storage.
Allows using s3 or Google storage as default file storage.
Extra: What is Django Allauth?
The list above includes the very best Django packages available in its rich ecosystem. But there’s one more package that I though should become part of this list as an extra.
This package offers an integrated set of Django applications that address problems like authentication, registration, account management, as well as third-party account authentication (think social media accounts).
Why I included it here:
The majority of existing Django apps which tackle the problem of social authentication focus only on that functionality. To support authentication via a local account, developers usually need to integrate another app. By following this approach, local and social authentications become separated and integrating them is challenging.
django-allauth was created to fill this gap, offering users a tool designed to include a fully-integrate authentication app that allows both local and social authentication.
Python has become an essential programming language for web development projects for many reasons. One of them is the rich ecosystem of libraries, frameworks, and tools like packages that help software developers accelerate the process of building apps, manage it better, and focus on what matters most (like app architecture or translating business logic).
I hope this list of Django packages helps you next time you develop a web app using Python and Django. If you want to learn more about Django packages, have a look at this helpful site: https://djangopackages.org/.
Also, don’t forget to browse our company blog for more handy tips about building Django apps!