This is an old revision of the document!
Deploy
- Set up virtualenv
- Install gunicorn
pip install gunicorn
- Set
allowed_hosts = 'domain.com
inproject/settings.py
- Collect static images to one directory
python manage.py collectstatic
- Run gunicorn
gunicorn –daemon –workers 3 –bind unix:/web/blog.kalen.pw/kalenpw.sock kalenpw.wsgi
Example Nginx config
- blog.kalen.pw
server { server_name blog.kalen.pw; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /web/blog.kalen.pw; } location / { include proxy_params; proxy_pass http://unix:/web/blog.kalen.pw/kalenpw.sock; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/kalen.pw/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/kalen.pw/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = blog.kalen.pw) { return 301 https://$host$request_uri; } # managed by Certbot server_name blog.kalen.pw; listen 80; return 404; # managed by Certbot }