#!/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) else: server.run_wsgi()