Skip to content

Instantly share code, notes, and snippets.

@trey
Created July 24, 2008 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trey/2042 to your computer and use it in GitHub Desktop.
Save trey/2042 to your computer and use it in GitHub Desktop.
Basic VirtualHosts information for serving Django projects using Apache and mod_python.
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
# - If you want to serve media files from the same server, you need to
# define `DocumentRoot` and the extra `Location` for the static folder.
# - If you also want to have your media folder inside your Django project,
# a `public/` folder is probably not a bad idea.
DocumentRoot /home/username/public_html/project_name/public/
PythonPath "['/home/username/public_html', '/home/username/sources/django/trunk/django'] + sys.path"
<Location "/">
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE app_name.settings
PythonDebug Off
</Location>
<Location "/static">
SetHandler None
</Location>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment