Django - Curated List with popular libraries: AllAuth, Django Extensions, DRF
This article presents a curated list with Django libraries that might help developers to code faster and easier heavy features like coding a REST Api, Social login, Django custom commands, or import/export database information. Django is usually branded as a "batteries included" framework and this article aims to list the best "batteries" we can use without much effort and boost our projects. For newcomers, Django is a Python Web framework built by experienced developers used in production by tech companies like Instagram and Disqus.
- Django Extensions - provides helpers like shell_plus, clean_pyc
- Django-environ - help us to manage the environment much easier
- Django-click - write custom commands
- Django-Allauth - Unlocks 3rd party (social) authentication: Google, Github
- Django Contact Form - helps developers manage forms with ease
- Django import / export - manage data with included admin integration.
- Django REST framework - a flexible toolkit for building Web APIs
- Django REST Swagger - Swagger/OpenAPI Doc Generator for Django
Being in production for more than 15 years, Django is actively supported by many open-source enthusiasts with monthly releases and improvements and these aspects are making Django the most popular Python-based web framework. Let's move on and presents a few libraries that might help us to code faster and enjoy the life on Earth.
Django Extensions
is a collection of custom extensions for Django including management commands (for manage.py script), additional database fields, and admin extensions:
- shell_plus - improved shell for Django
- export_emails - export email addresses for your users in one of many formats
- sqlcreate - Helps setup a database more easily
Django-environ
Allows us to use Twelve-factor methodology to configure your Django application with environment variables. Using this module, we can manage the environment variables with ease by specifying default values, cast options, etc.
Installation
$ pip install django-environ
Sample .env file
DEBUG=on
SECRET_KEY=your-secret-key
Usage in code
import environ
env = environ.Env(
# set casting, default value
DEBUG=(bool, False)
)
# Raises django's ImproperlyConfigured exception
# if SECRET_KEY not in os.environ
SECRET_KEY = env('SECRET_KEY')
Django-click
A library to easily write Django management commands using the click
command line library.
Installation
pip install django-click
Sample
# New file saved on:
# <yourapp>/management/commands/helloworld.py
import djclick as click
@click.command()
@click.argument('name')
def command(name):
click.secho('Hello, {}'.format(name), fg='red')
Usage
$ ./manage.py helloworld django-click
Hello, django-click
Django-allauth
Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.
- Django AllAuth - official docs
- Django AllAuth - source code (MIT License)
- Free All-Auth Sample (MIT License) - provided by AppSeed
Django import / export
Django application and library for importing and exporting data with included admin integration - Features:
- support multiple formats (Excel, CSV, JSON)
- admin integration for importing
- preview import changes
- admin integration for exporting
- export data respecting admin filters
For more information, please access the official documentation or take a look at an open-source sample that implements this library: Django Simple Charts.
Django REST framework
A popular application used for rapidly building RESTful APIs based on Django models. For newcomers, REST is a protocol for listing, creating, changing, and deleting data on your server over HTTP. The Django REST framework (DRF) is built on top of Django that help us to reduce the amount of code usually required to create REST HTTP API interfaces.
- DRF (Django REST Framework) - home page
- Free Django Sample - implements and used DRF framework
Django REST Swagger
Swagger/OpenAPI Documentation Generator for Django REST Framework
Installation
$ pip install django-rest-swagger
Update settings to include 'rest_framework_swagger'
to INSTALLED_APPS
section.
settings.py
INSTALLED_APPS = [
...
'rest_framework_swagger',
...
]
Thanks for reading! For more resources, please access:
- Django - the official website
- Django Web Framework - Server-side programming
- Django - Introduction for Beginners
- Django Dashboards - a curated index provided by AppSeed
Datta Able Django
Production-ready Django dashboard coded with authentication, database, modular codebase on top of a modern UI: Datta Able admin dashboard (free version). Datta Able rendering is fast in all major browsers. It is passed through a good score in Google Page Speed, Pingdom, GT Metrix. Code passed via w3 validators with all w3 standards. This admin panel is fully responsive and tested on all retina devices.
- Datta Able Django - product page
- Datta Able Django Demo - LIVE Deployment
Django Bootstrap 5 Volt
Open-source Django Bootstrap 5 seed project crafted with authentication, basic modules, deployment scripts on top of a modern jQuery-free design - Volt Dashboard. This Dashboard Template is designed on top of Bootstrap, the world’s most popular framework for building responsive, mobile-first sites.
- Django Bootstrap 5 Volt - product page
- Django Bootstrap 5 Volt Demo - LIVE deployment
Django Dashboard Argon
Argon Dashboard is built with over 100 individual components, giving you the freedom of choosing and combining. Every component has multiple states for colors, styles, hover, focus, that you can easily access and use. The Django codebase comes with SQLite database, native ORM, session-based authentication, and deployment scripts for Docker, Gunicorn/Nginx stack.
- Django Dashboard Argon - product page
- Django Dashboard Argon Demo - LIVE Deployment