blob: a380241983fd10d5f3fa165cc08bf604e3492a52 (
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
|
#!/usr/bin/python2
"""script used to run the webserver"""
import sys
from subprocess import Popen
from photoblaster.server import Server
from photoblaster.config import LOCAL
server = Server()
if __name__ == "__main__":
if LOCAL:
sys.stderr.write(
"RUNNING LOCAL VERSION OF SERVER\n"
"TO RUN PRODUCTION VERSION SET ENVIRONMENT VARIABLE"
"PB_PRODUCTION=1...ie\n"
"$>export PB_PRODUCTION=1\n"
)
#test if nginx is running
test = Popen(['pgrep', 'nginx'])
test.communicate()
if test.returncode:
sys.stderr.write(
"ERROR:\n"
"you must start nginx to serve static content\n")
sys.exit(1)
server.run(threaded=True, processes=4)
else:
server.run_wsgi()
|