fixes #854: republish a book with parent correctly
[wolnelektury.git] / wolnelektury.wsgi.template
1 #!%(python)s
2 import site
3 site.addsitedir('%(path)s/lib/python2.5/site-packages')
4
5 import os
6 from os.path import abspath, dirname, join
7 import sys
8
9 # Redirect sys.stdout to sys.stderr for bad libraries like geopy that use
10 # print statements for optional import exceptions.
11 sys.stdout = sys.stderr
12
13 # we don't want these packages to cover our virtualenv
14 sys.path = [p for p in sys.path if not p.startswith('/usr/lib/python2.5/site-packages') and not p.startswith('/var/lib/python-support/python2.5')]
15
16 # Add apps and lib directories to PYTHONPATH
17 sys.path = [
18         '%(path)s/releases/current/%(project_name)s',
19         '%(path)s/releases/current',
20         '%(path)s/releases/current/apps',
21         '%(path)s/releases/current/lib',
22     '%(path)s/releases/current/lib/librarian',
23 ] + sys.path
24
25 # Run Django
26 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
27
28 from django.core.handlers.wsgi import WSGIHandler
29 application = WSGIHandler()