Created
August 1, 2016 10:37
-
-
Save jarshwah/52c721f4883d739a216840f6de881714 to your computer and use it in GitHub Desktop.
Config files for deploying django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some of the filenames have been named to make things slightly easier to understand | |
# uwsgi parameters that instruct uwsgi how to run | |
/path/to/project/uwsgi-conf.ini | |
# the wsgi file that django generates for your project | |
/path/to/yourproject/yourproject/wsgi.py | |
# nginx config connects to the uwsgi unix socket | |
/etc/nginx/sites-enabled/yourproject.conf | |
/etc/nginx/conf.d/yourproject_upstream.conf | |
# init system script to start uwsgi which is installed to the virtualenv of the project | |
/etc/init/yourproject_upstart.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[uwsgi] | |
uid = nginx | |
gid = nginx | |
master = true | |
buffer-size = 32768 | |
chdir = /path/to/yourproject/ | |
socket = /tmp/uwsgi_yourproject.socket | |
chmod-socket = 666 | |
chown-socket = nginx | |
logto = /var/log/uwsgi/yourproject.log | |
log-date = true | |
logfile-chown = nginx | |
master = True | |
max-requests = 5000 | |
module = yourproject.wsgi:application | |
processes = 4 | |
threads = 4 | |
thunder-lock = 1 | |
vacuum = True | |
memory-report = true | |
env=LANG=en_AU.UTF-8 | |
env=LC_ALL=en_AU.UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
WSGI config for peppermint project. | |
It exposes the WSGI callable as a module-level variable named ``application``. | |
For more information on this file, see | |
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ | |
""" | |
import os | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "yourproject.settings") | |
from django.core.wsgi import get_wsgi_application | |
application = get_wsgi_application() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen *:8080; | |
server_name yourproject.com.au; | |
access_log /var/log/nginx/yourproject_access.log; | |
error_log /var/log/nginx/yourproject_error.log; | |
location ^~ /media/ { | |
alias /media/django/yourproject/media/; | |
} | |
location ^~ /static/ { | |
alias /media/django/yourproject/static/; | |
} | |
location / { | |
include /etc/nginx/uwsgi_params; | |
uwsgi_pass yourproject_uwsgi; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "uWSGI Your Project Upstart Config" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
pre-start script | |
mkdir -p "/var/log/uwsgi/" | |
mkdir -p "/var/run/uwsgi/" | |
chown -R nginx:nginx "/var/log/uwsgi/" | |
chown -R nginx:nginx "/var/run/uwsgi/" | |
end script | |
exec /path/to/project/venv/bin/uwsgi --die-on-term --ini /path/to/project/uwsgi-conf.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream yourproject_uwsgi { | |
server unix:/tmp/uwsgi_yourproject.socket fail_timeout=10s; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment