<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from edwinServer . web . app import app <EOL> import logging <EOL> import logging . config <EOL> from edwinServer . web import conf as web_conf <EOL> from edwinServer . common import conf <EOL> from edwinServer . common import my_logging <EOL> from edwinServer . common import os_helper <EOL> log_file = os_helper . getLoggingFileName ( __file__ ) <EOL> root_logger = logging . getLogger ( ) <EOL> my_logging . configureLogger ( root_logger , log_file , conf . log_level ) <EOL> def run_on_default_server ( ) : <EOL> if app . debug : <EOL> app . run ( host = '<STR_LIT>' , port = web_conf . PORT , debug = True ) <EOL> else : <EOL> app . run ( host = '<STR_LIT>' , port = web_conf . PORT , ) <EOL> def run_on_cherrypy_server ( ) : <EOL> if app . debug : <EOL> run_on_cherrypy_auto_reload ( ) <EOL> else : <EOL> run_on_cherrypy_for_production ( ) <EOL> def run_on_cherrypy_auto_reload ( ) : <EOL> '''<STR_LIT>''' <EOL> import cherrypy <EOL> cherrypy . tree . graft ( app , '<STR_LIT:/>' ) <EOL> cherrypy . config . update ( { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : web_conf . PORT , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } ) <EOL> cherrypy . engine . start ( ) <EOL> cherrypy . engine . block ( ) <EOL> def run_on_cherrypy_for_production ( ) : <EOL> '''<STR_LIT>''' <EOL> from cherrypy import wsgiserver <EOL> dispatch = wsgiserver . WSGIPathInfoDispatcher ( { '<STR_LIT:/>' : app } ) <EOL> server = wsgiserver . CherryPyWSGIServer ( ( '<STR_LIT>' , web_conf . PORT ) , dispatch ) <EOL> try : <EOL> server . start ( ) <EOL> except KeyboardInterrupt : <EOL> server . stop ( ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> if web_conf . depoly_on_cherrypy : <EOL> run_on_cherrypy_server ( ) <EOL> else : <EOL> run_on_default_server ( ) </s>
