Cookiecutter Drf

screenshot of Cookiecutter Drf
django

A batteries-included, opinionated template for Django Rest Framework APIs

Overview

cookiecutter-drf is a Python package that provides a ready-to-use Django Rest Framework project template. It offers a set of pre-configured features and tools to help developers quickly set up a robust REST API backend. With cookiecutter-drf, users can easily generate a project with features like containerization, database management, authentication, API documentation, testing, code quality, and continuous deployment.

Features

  • Architecture: cookiecutter-drf projects are containerized with Docker and built using Python 3.7 and Django 2.2.
  • Web server: The project template includes Gunicorn and Uvicorn as the web servers.
  • Databases: PostgreSQL and Redis are included for efficient database management.
  • Dependency and python version management: Pipenv is used for dependency management and python version control.
  • Tasks: The template integrates Celery and Celery Beat for task management.
  • Utilities: cookiecutter-drf provides better settings management (using django-environ and django-configurations), improved logging (including Sentry and logutils), and common model fields and mixins (using django-model-utils).
  • API: Django Rest Framework is used for API development. The template provides Swagger UI, Redoc UI, and OpenAPI schema for API documentation. It also includes QuerySet filtering using django-filter.
  • Authentication: The template supports custom user models, authentication endpoints using djoser, and social authentication and OAuth2 integration with social-auth-app-django, django-oauth-toolkit, and django-rest-framework-social-oauth2.
  • Testing and Code Quality: pytest is used as the test framework, along with pytest-django for Django integration. The template also includes django-rest-assured for easy API testing, factory-boy for generating test data, and code quality tools like Flake8 and Black. Code coverage is monitored using pytest-cov, and CI integration is provided with Travis CI.
  • Continuous Deployment: cookiecutter-drf projects can be easily deployed to Heroku.

Summary

cookiecutter-drf is a powerful tool for quickly setting up a Django Rest Framework project with a comprehensive set of features and tools. With its easy installation process and pre-configured template, developers can save time and effort in setting up their backend infrastructure. Whether it's containerization, database management, authentication, API documentation, testing, or even continuous deployment, cookiecutter-drf provides a solid foundation for building REST APIs with Django.

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.