Skip to content

Simple docker template that uses Django, MySQL, Celery, Flower, RabbitMQ, Grafana and Prometheus.

License

Notifications You must be signed in to change notification settings

earnestat/BackendTemplate

 
 

Repository files navigation

Backend App Template

Django + Docker + MySQL + Celery + RabbitMQ + Flower + Grafana + Prometheus


The goal of this project is to enable an easy-to-use template in order to start developing a web application as quickly and conveniently as possible.

The environment we are looking to build is one that uses Django as a python framework for web development with MySQL as a database, DjangoRESTFramework to build it as an API; Celery with RabbitMQ for managing asynchronous tasks, and Flower for monitoring those tasks.

The project will be in Docker containers that will be already set up just to start coding the project, following as much as possible the twelve factor app principles in order to be ready to add any kind of environment maintaining coherence and traceability.

This project has features such as:

  • Authentication (login and sign up) for users using JWT.
  • Social OAuth for Google, Facebook and Twitter.
  • Permissions for admin users.
  • Password recovery through email.
  • Email system.
  • Notification (global emails) system.
  • Customization of emails according the preferred language of users.
  • Blacklist to allow users receive only those type of emails they are interested in.
  • Mailbox where suggestions/bugs/others can be sent.
  • Amazon web services S3 buckets compatibility.
  • CRON jobs using Celery and RabbitMQ.
  • Database caching system to have a better performance using Redis.
  • Prometheus statistics that can be easily configured with Grafana.
  • CI pipelines, ready to implement the CD part.
  • Github templates for issues and pull requests.
  • Github releases for merges on master based on tags.
  • 100% of test coverage.

Table of Contents

Name Description
Requirements Must have in order to run the project.
Nice to have This would help you a lot to work with this template.
Nice to look at Documentation of the resources used in the template.
Before starting Naming disclaimer that would be better to do before starting.
Instructions Instructions to raise the project and start developing.
Main urls Main urls you can access after running the project.
Observations Observations in order to interact with the codebase.
Versions used Versions used in this project.
Useful tools Useful tools to understand/improve this project based on your needs.

Requirements

Nice to have

Nice to take a look to

Before starting

  • Look at the User model and think if it fits your needs, because changing it after some work done can be hard.

  • Feel free to set your environment variables as you want on .env files.

  • You can change the container name by changing the main folder name.

  • You can change the project name to your actual app name, just take in mind that you will need to change folder names, docker-compose.yml content, Dockerfile content and some Django settings in order for the container work correctly.

Instructions

  1. Go to root content folder.

  2. Raise the docker containers running: make docker up

  3. That's all!

⚠️ Disclaimer: if you don't have make installed, you can run:

docker-compose -f ./Docker/Local/docker-compose.yml --env-file ./Docker/Local/docker.env up

Main urls

After running the project:

Observations

You can run make or make help in order to see all the possibles commands you have to interact with the project.

As first steps in order to correctly interact with it, you have to run:

  1. make migrations
  2. make populate This will create fake data, including admin user with credentials:

Grafana Credentials will be - user: admin - password: admin

You will be able to change them once you are logged in.

Versions used


Reviewed on 2022/11/14.

  • Docker compose schema version: 3.9
  • Python image: 3.10.5
  • RabbitMQ image: 3.9.21
  • MySQL image: 8.0.30
  • Redis image: 7.0.3
  • Django version: 4.1.2
  • DjangoRESTFramework version: 3.12.4
  • Celery version: 5.2.3

Useful tools

These are useful tools to customize/develop your django project.

Links Description
Medium or Linkedin posts Tutorial to modify custom django user model.
Postman API endpoints.zip Collections of the endpoints ready to use in postman.
Simple social OAuth frontend This is a small frontend project you can use to test the OAuth endpoints.

About

Simple docker template that uses Django, MySQL, Celery, Flower, RabbitMQ, Grafana and Prometheus.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.8%
  • CSS 1.6%
  • Dockerfile 1.4%
  • Makefile 1.4%
  • HTML 0.8%