Skip to content

Instantly share code, notes, and snippets.

@kayode-adechinan
Last active June 17, 2019 08:56
Show Gist options
  • Save kayode-adechinan/66b66b1d6f2ec2559fcd13aab3f397b5 to your computer and use it in GitHub Desktop.
Save kayode-adechinan/66b66b1d6f2ec2559fcd13aab3f397b5 to your computer and use it in GitHub Desktop.
1. Define this in your setting.py
DEBUG = False
STATIC_ROOT = '/opt/lampp/htdocs/static/'
2. Run
python manage.py collectstatic
3. Create a proxy -> sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName djangocdn
ProxyPreserveHost On
ProxyPass /static/ !
# optional -> uncomment the line below if you want to define custom static folder
# Alias /static/ "/opt/lampp/htdocs/static/"
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
# error handling
ErrorDocument 503 http://137.74.199.121/messages/wait.html
</VirtualHost>
4. Run
gunicorn.projectname.wsgi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment