blob: 17a793e359a278fb4f993a9d8230273975e9e87c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
from django.core import management
def main(settings_file, logfile=None):
try:
mod = __import__(settings_file)
components = settings_file.split('.')
for comp in components[1:]:
mod = getattr(mod, comp)
except ImportError, e:
import sys
sys.stderr.write("Error loading the settings module '%s': %s"
% (settings_file, e))
sys.exit(1)
# Setup settings
management.setup_environ(mod)
from django.conf import settings
options = getattr(settings, 'FCGI_OPTIONS', {})
if logfile:
options['outlog'] = logfile
options['errlog'] = logfile
from django.core.servers.fastcgi import runfastcgi
# Run FASTCGI handler
runfastcgi(**options)
|