Python Django Drf Boilerplate

screenshot of Python Django Drf Boilerplate
django

Django Boilerplate for starting fresh new DRF projects

Overview:

The Django Rest Framework Boilerplate is a starter template for creating fresh new Django Rest Framework projects. It is built using cookiecutter-django-rest and offers a modern Python development environment with Python 3.8+ and Django 3.1+. The boilerplate is fully dockerized for easy local development using docker-compose and includes PostgreSQL for the database. It also provides full test coverage, continuous integration, and continuous deployment capabilities. Some of the key features included are JSON Web Token authentication, social sign-up/sign-in using Facebook and Google, API throttling, password reset endpoints, user model with a profile picture field using Easy Thumbnails, files management with automatic thumbnail generation for images, Sentry setup for error monitoring, Swagger API documentation out-of-the-box, code formatter using black, tests with mocking and factories, and API documentation generation using Swagger.

Features:

  • Modern Python Development: Built using Python 3.8+ and Django 3.1+.
  • Fully Dockerized: Easy local development using docker-compose.
  • PostgreSQL: Uses PostgreSQL as the database.
  • Full Test Coverage: Includes tests, continuous integration, and continuous deployment.
  • JSON Web Token Authentication: Built-in authentication using Simple JWT.
  • Social Sign-up/Sign-in: Integration with Facebook and Google for social sign-up and sign-in.
  • API Throttling: Throttling enabled for API requests.
  • Password Reset Endpoints: Provides endpoints for password resets.
  • User Model with Profile Picture Field: Includes a user model with a profile picture field using Easy Thumbnails for thumbnail generation.
  • Files Management: Automatically generates thumbnails for images.
  • Sentry Setup: Includes setup for error monitoring with Sentry.
  • Swagger API Docs: Provides API documentation out-of-the-box using Swagger.
  • Code Formatter: Includes code formatter using black.
  • Tests with Mocking and Factories: Tests include mocking and factories for easy testing.
  • API Documentation: API documentation automatically generated with Swagger.

Prerequisites:

  • Docker (if using Docker) or Python3 and Postgres installed (if not using Docker).

Local Development with Docker:

  1. Start the dev server for local development:
docker-compose up -d --build
  1. Run a command inside the Docker container:
docker-compose exec web python manage.py migrate

Local Development without Docker:

  1. Install the dependencies:
pip install -r requirements/local.txt
  1. Run the dev server:
python manage.py runserver

Create Superuser:

If desired, create an initial superuser with the following command:

python manage.py createsuperuser

Running Tests:

To run all tests with code coverage report, simply run the following command:

coverage run manage.py test
coverage report

Summary:

The Django Rest Framework Boilerplate is a comprehensive starter template for Django Rest Framework projects. It offers a modern Python development environment and includes several features such as authentication, social sign-up/sign-in, API throttling, password reset endpoints, user model with profile picture field, automatic thumbnail generation, Sentry setup, Swagger API documentation, code formatting, tests with mocking and factories, and more. The boilerplate is easy to install, with options for Docker-based or non-Docker-based local development. It also provides full test coverage and includes continuous integration and continuous deployment capabilities. Overall, it provides a solid foundation for building robust and scalable Django Rest Framework applications.

django
Django

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It follows the model-view-controller (MVC) architectural pattern, providing an extensive set of built-in tools and conventions to streamline the creation of robust and scalable web applications.

docker
Docker

A website that uses Docker for containerization to streamline development, testing, and deployment workflows. This includes features such as containerization of dependencies, automated builds and deployments, and container orchestration to ensure scalability and availability.