Skip to content

Instantly share code, notes, and snippets.

@trey
Created September 20, 2008 21:48
Show Gist options
  • Save trey/11794 to your computer and use it in GitHub Desktop.
Save trey/11794 to your computer and use it in GitHub Desktop.
Using mod_wsgi for a Django project.
# http://www.technobabble.dk/2008/aug/25/django-mod-wsgi-perfect-match/
<VirtualHost *:80>
ServerAdmin you@example.com
ServerName example.com
DocumentRoot /home/you/public_html/example_com/public
# Django settings
WSGIScriptAlias / /home/you/public_html/example_com/wsgi_handler.py
WSGIDaemonProcess example_com user=you group=you processes=1 threads=10
WSGIProcessGroup example_com
# Non-Django directories
Alias /static /home/you/public_html/example_com/public/static/
<Location "/static">
SetHandler None
</Location>
</VirtualHost>
# http://www.technobabble.dk/2008/aug/25/django-mod-wsgi-perfect-match/
import os, sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
os.environ['DJANGO_SETTINGS_MODULE'] = 'example_com.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment