Added some PYTHONPATH hackery to manage.py, wolnelektury.wsgi and wolnelektury.fcgi.
[wolnelektury.git] / wolnelektury.fcgi
1 #!/usr/bin/env python
2 from os.path import abspath, dirname, join
3 import sys
4
5 # Redirect sys.stdout to sys.stderr for bad libraries like geopy that use
6 # print statements for optional import exceptions.
7 sys.stdout = sys.stderr
8
9 # Add apps and lib directories to PYTHONPATH
10 sys.path.insert(0, abspath(join(dirname(__file__), '../apps')))
11 sys.path.insert(0, abspath(join(dirname(__file__), '../lib')))
12
13 # Emulate manage.py path hacking.
14 sys.path.insert(0, abspath(join(dirname(__file__), "../../")))
15 sys.path.insert(0, abspath(join(dirname(__file__), "../")))
16
17 # Run Django
18 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
19
20 from django.core.servers.fastcgi import runfastcgi
21 runfastcgi(method='threaded', daemonize='false')
22