Skip to content

Commit

Permalink
Add sample configuration files for production (issue #3)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatti committed Apr 16, 2012
1 parent cb902c8 commit 60da76a
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Point your browser to <http://127.0.0.1:8000/admin/>

Directories
-----------
* database: Sqlite3 databases
* conf: Sample configuration files for nginx and uWSGI
* database: Sqlite3 databases for use in development
* grader: Directories for each problem and their sets of inputs and expected
outputs
* media: Files to be transferred to and received from users
Expand Down
39 changes: 39 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Sample nginx config file
# file: /etc/nginx/conf.d/default.conf

server {
listen 80;
server_name _;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
uwsgi_pass unix:///tmp/uwsgi.sock;
include /etc/nginx/uwsgi_params;
root /usr/share/nginx/html;
index index.html index.htm;
}

location /media {
internal;
alias /www/UPEProgComp/media/;
}

location /static {
alias /www/UPEProgComp/static/;
}

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
30 changes: 30 additions & 0 deletions conf/uwsgi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Sample uWSGI config file
# file: /etc/init/uwsgi.conf
description "uWSGI starter"

start on (local-filesystems and runlevel [2345])
stop on runlevel [016]

respawn

# home - is the path to our virtualenv directory
# pythonpath - the path to our django application
# module - the wsgi handler python script

exec /usr/bin/uwsgi \
--uid uwsgi \
--gid deployment \
--home /www/UPEProgComp \
--chdir /www/UPEProgComp/progcomp \
--pythonpath /www/UPEProgComp \
--env DJANGO_SETTINGS_MODULE=progcomp.settings \
--socket /tmp/uwsgi.sock \
--chmod-socket \
--module progcomp.wsgi \
--logdate \
--processes 2 \
--master \
--umask 002 \
--logto /var/log/uwsgi/uwsgi.log \
--log-reopen \
--log-truncate
12 changes: 12 additions & 0 deletions progcomp/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
import sys
import site

site.addsitedir('/usr/lib/python2.7/site-packages')

sys.path.append('/www/UPEProgComp')

os.environ['DJANGO_SETTINGS_MODULE'] = 'progcomp.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

0 comments on commit 60da76a

Please sign in to comment.