Skip to content

Deploying Django with Nginx and Gunicorn

Complete guide to deploying Django applications in production.

Production Django Deployment

Learn how to properly deploy Django with Nginx as reverse proxy.

Install Requirements

pip install gunicorn
sudo apt install nginx

Gunicorn Service

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=www-data
Group=www-data
WorkingDirectory=/var/www/myproject
ExecStart=/var/www/myproject/venv/bin/gunicorn --bind unix:/run/gunicorn.sock myproject.wsgi

[Install]
WantedBy=multi-user.target
{# Provenance for articles generated from a source document. Rendered here rather than stored in the body so it stays accurate and cannot be edited away, and so the sealed draft stays purely generated. #}

Discussion

0

No comments yet. Be the first to start the discussion!

Leave a Comment

Comments are reviewed before they appear.

Write a comment