forked from skylines-project/skylines
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskylines.fastcgi
executable file
·38 lines (30 loc) · 1.21 KB
/
skylines.fastcgi
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
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
#
# Wrapper script for launching Skylines as a FastCGI in lighttpd.
#
import os
import sys
import thread
import argparse
from config import to_envvar
parser = argparse.ArgumentParser(description='Run the SkyLines FastCGI daemon.')
parser.add_argument('config_file', nargs='?', metavar='config.ini',
help='path to the configuration INI file')
parser.add_argument('--socket', nargs='?', metavar='PATH',
help='path of the local socket')
parser.add_argument('--logfile', nargs='?', metavar='PATH',
help='path of the log file')
args = parser.parse_args()
if not to_envvar(args.config_file):
parser.error('Config file "{}" not found.'.format(args.config_file))
# stderr doesn't work with FastCGI; the following is a hack to get a
# log file with diagnostics anyway
if args.logfile:
sys.stderr = sys.stdout = file(args.logfile, 'a')
sys.path.append(os.path.dirname(sys.argv[0]))
thread.stack_size(524288)
if __name__ == '__main__':
from flup.server.fcgi import WSGIServer
from skylines import create_combined_app
WSGIServer(create_combined_app(), bindAddress=args.socket, umask=0,
minSpare=1, maxSpare=5, maxThreads=50).run()