https://github.com/kamaroly/django-docker-gunicorn-nginx
Repo I used to learn about deployment of Django applications using docker gunicorn and the nginx
https://github.com/kamaroly/django-docker-gunicorn-nginx
Last synced: over 1 year ago
JSON representation
Repo I used to learn about deployment of Django applications using docker gunicorn and the nginx
- Host: GitHub
- URL: https://github.com/kamaroly/django-docker-gunicorn-nginx
- Owner: kamaroly
- Created: 2022-12-12T07:10:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-15T17:53:58.000Z (over 3 years ago)
- Last Synced: 2025-01-21T23:33:01.250Z (over 1 year ago)
- Language: Python
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Django Docker Gunicorn Nginx Deployment
I wrote this repository as an exercise to learn how to deploy Django application on production using Docker Gunicorn and the Nginx server.
`python manage.py runserver` is sufficient for development but not optimized and safe for production.
## Gunicorn
It helps us start run django application for production. It makes it possible to run multiple worker and it rebootes them when they fail automatically. It is optimized for production.
Each Django application comes with a `wsgi.py` file that makes it possible to run it with **gunicorn** server.
> gunicorn does not serve static files, thus, we need to leverage nginx proxy for that.
## Nginx proxy
Nginx has been the favorite web server for millions of use and it is being used in millions of production servers. In this setup it helps us to do two 2 things
1. Serves as **proxy** to gunicorn server at port 8000
2. Serves static files from the docker volume called `static` if the request comes with first URL segment `/static/`
The combination of the gunicorn and nginx makes it possible to run django application in production mode with full assurance of security and production ready optimization.
# TODO
1. Generalize this repository so that other developer can use it for their django app deployments.