Skip to content

The ultimate Django template: production ready Django 4.1 with Docker, HTTPS and CI/CD using Github actions β€ŽοΈβ€πŸ”₯

License

Notifications You must be signed in to change notification settings

adriancast/django-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

91 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

The ultimate Django template to build a startup

Lets be clear. If you can do a task in less than 5 minutes why would you even bother in do all this hard work by yourself? This cookie cutter provides you with:

  1. Django base project: The wizzard will create a default Django project structure
  2. CI/CD integration with Github actions: Github actions will be already configured in your project. It will deploy to your production server everytime a new commit is pushed to the master branch.
  3. Docker: you will get Docker support out of the box. You will get a production ready Docker environment and also a local development environment to add new features to your project.
  4. Docker environment files: The template will automatically the environment files that contains all the sensetive data. This files will not be reposited in your project to prevent password leaks.
  5. HTTPS out of the box: When using the template wizard, you must use the real production domain for your project. This will be used to create the certificates of your production domain. The certificates will be automatically renewed.
  6. Monitoring: If selected in the wizard, Sentry configuration will be added to your project. Remember to edit the Sentry DSN once you created your project in order to connect your project with your Sentry account.
  7. Metrics: If selected in the wizard, Grafana and Prometheus will be added to your project. This template will configure the datasource automatically and will add a dashboard to your Grafana displaying basic metrics of your Django application.

Languages and Technologies πŸ‘¨πŸ»β€πŸ’»

Django Docker Python HTML5 Nginx GitHub Actions Postgres DigitalOcean Prometheus Grafana

Architecture Diagram

Arhitecture Diagram

Things to take in consideration

  • The .envs generated by the template will be in the .gitignore. Those files will be generated but will not be reposited. When you install the app in the server, make sure that you copy the .env files.

  • In order to make Letsencrypt generate the certificates it will use a HTTP-01 challenge. In order to configure the pro environment, make sure that the domain configured in the cookicuter is properly configured in the DNS side. You must add A and AAA records in order to make letsencrypt work. If you want to learn more of the challenges that Letsencrypt does, follow this guide.

Usage of the django-template

To execute the cookiecutter template wizard run:

$ pip install cookiecutter
$ cookiecutter gh:adriancast/django-template

If you need more information about cookiecutter visit this oficial guide.

Screenshot from 2021-07-11 13-09-40