14 Django packages you should know

Andrzej Dabski - Python Developer at Sunscrapers

Andrzej Dabski

11 January 2023, 10 min read

thumbnail post

What's inside

  1. Intro
  2. But first - is Django a library?
  3. Modules vs. packages - what are modules in Django?
  4. The best Django packages
  5. Extra: What is Django Allauth?
  6. Summary
  7. Contact us
  8. Resources

Initially published: 21st of June 2018 Updated: 6th of December 2022

Intro

Are you starting a Django project soon? You’re probably wondering whether there are any valuable packages out there that could help you with your projects.

In this piece, you’ll find 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 Python tools because many new frameworks and libraries are available in its ecosystem today.

Read more: 10 Best Python Web Frameworks

Still, it's worth clarifying this: Django is not a library but a framework.

Django is a free, open-source, high-level, complete 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.

The best Django packages

Note: Since there are several good reasons why coding frontend in Django isn’t the best idea, the following list contains only packages for backend projects.

  1. sentry-sdk

Documentation

Description:

  • This is a must-have tool for any Django project, as we must stay informed about all the code-based issues in the application.
  • Firstly: the package immediately alerts us about all the previously-uncaught exceptions in production.
  • Secondly: we can catch the issue ourselves and send the error information to the sentry, adding more relevant data.
  • Building an alert system on our own is non-trivial and debugging without this kind of logs is next to impossible.

Solves:

That situation is when the server throws an error, and you don’t have to investigate it.

Awesomeness:

  • 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 helpful as an alert system to which we can send the errors or logs about non-normal events.
  1. djangorestframework

Documentation

Description:

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.

Solves:

No need to write the REST API yourself.

Awesomeness:

  • 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

  1. django-extensions

Documentation

Description:

  • A set of tools that help with your daily work.
  • JSONField was introduced in this package before officially becoming 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 found them rather boring and uncommon.

Solves:

It adds a bunch of random valuable functionalities.

Awesomeness:

  • command shell_plus runs the 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

  1. django-rest-framework-jwt

Documentation

Description:

While using DRF for some projects, adding some JWT token authorization is essential. That’s exactly what this package is about.

Solves:

You won’t have to implement and manage the Authentication token for the API on your own.

Awesomeness:

Provides everything you need for JWT Auth: the login endpoint and Django auth class.

  1. django-rest-swagger

Documentation

Description:

The DRF offers auto-generated documentation – and this package makes the documentation nicer for your projects.

Solves:

Creates nice documentation out of the DRF API for free.

Awesomeness:

  • Nice auto-documentation for your endpoints.
  • It's easy to document custom endpoints manually.
  1. easy-thumbnails

Documentation

Description:

Any web service that allows uploading and viewing photos need the thumbnails feature. This package provides it.

Solves:

All servers hosting images need thumbnails, and this package is the solution.

Awesomeness:

Configurable thumbnails filed for Django models that automatically generate a smaller version of the uploaded image.

  1. django-simple-history

Documentation

Description:

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 want to return to the previous text version.

Solves:

Keeps a history of changed rows in the database.

Awesomeness:

Keeps track of all model changes while setup takes no time.

  1. django-adminactions

Documentation

Description:

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.

Solves:

Adds some functions that come in handy during the early stages of developing an app.

Awesomeness:

Export data from the admin panel to XSL, CSV, and Fixture.

  1. django-model-utils

Documentation

Description:

A set of useful utils for Django models.

Solves:

Adds some models and fields that already help with some common issues.

Awesomeness:

MonitorField field is the DateTime field, and it's updated to now() each time the field it’s looking to get updated.

  1. django-storages

Documentation

Description:

  • Allows using any cloud storage services as the default file storage. That becomes important when you want to pass whatever users send to another storage.
  • For example, users may send us substantial data like photos, movies, or 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.

Solves:

It uses almost any remote storage as the Django default file storage.

Awesomeness:

Allows using s3 or Google storage as default file storage.

  1. django-filter

Documentation

Description:

  • It uses a two part CalVer versioning scheme (such as 21.1).
  • Django-Filter is a mature and stable package.
  • It is a generic, reusable application to alleviate writing some of the more mundane bits of view code.

Solves:

It allows users to filter down a queryset based on a model's fields, displaying the form to let them do this.

Awesomeness:

  • Django-filter can be used for generating interfaces similar to the Django admin’s list_filter interface.
  • It has an API very similar to Django’s ModelForms.
  1. django-debug-toolbar

Documentation

Description:

  • Configurable set of panels which allows displaying debug information about the current request and response.
  • After the click it displays more details about the panel’s content.

Solves:

  • Request variables, including GET, POST, cookie, and session information.
  • Which templates were rendered the context provided to each template.

Awesomeness:

It can show all SQL queries performed during response creation and processing, including timing and 'EXPLAIN' output for each query in conjunction with the total time spent performing SQL queries. If python-pygments is installed, the SQL syntax is highlighted.

  1. django-cors-headers

Documentation

Description:

django-cors-headers is a security oriented package designed to protect users from malicious websites by providing a mechanism to allow only specific domains to perform those cross origin requests.

Solves:

  • It adds Cross-Origin Resource Sharing (CORS) headers to responses.
  • This allows in-browser requests to the Django application from other origins.

Awesomeness:

It adds another security layer on top of already quite impressive django security feature list.

Extra: What is Django Allauth?

The list above includes the best Django packages available in its rich ecosystem. But one more package should become part of this list as an extra.

django-allauth

Documentation

This package offers an integrated set of Django applications that address problems like authentication, registration, account management, and third-party account authentication (think social media accounts).

Why did I include it here?

The majority of existing Django apps that 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 incorporating them is challenging.

django-allauth was created to fill this gap, offering users a tool designed to include a fully-integrated authentication app that allows both local and social authentication.

Summary

For many reasons, Python has become an essential programming language for web development projects. 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).

This list of Django packages will help you next time you develop a web app using Python and Django. To learn more about Django packages, look at this helpful site.

Contact us

At Sunscrapers, we have a team of developers and software engineers with outstanding technical knowledge and experience. We can build your project successfully.

Talk with us about hiring Python and Django developers and work with the best. Sunscrapers can help you make the most out of Python, Django, and other technologies to put your project to the next level.

Contact us at hello@sunscrapers.com

Resources

Sunscrapers Guide to the Django REST Framework

Articles mentioned in the post:

  1. Migrating Python 2 to Python 3
  2. 10 Best Python Web Frameworks
  3. What is Django and how to get started?
  4. 30 built-in Python modules you should be using
  5. The Ultimate Django Rest Framework Tutorial
  6. 6 expert tips for building better Django models
Andrzej Dabski - Python Developer at Sunscrapers

Andrzej Dabski

Python Developer

Andrzej is a Python developer who has been involved in many different projects, from the healthcare industry to lending cryptocurrency project. He likes to work on projects that allow him to learn new things. Andrzej is currently studying Computer Science and likes to catch up with all the latest technologies. He likes good puzzles and bad jokes.

Tags

python
django
django rest framework

Share

Recent posts

See all blog posts

Are you ready for your next project?

Whether you need a full product, consulting, tech investment or an extended team, our experts will help you find the best solutions.

Hi there, we use cookies to provide you with an amazing experience on our site. If you continue without changing the settings, we’ll assume that you’re happy to receive all cookies on Sunscrapers website. You can change your cookie settings at any time.