<s> """<STR_LIT>""" <EOL> from google . appengine . tools import os_compat <EOL> import getopt <EOL> import logging <EOL> import os <EOL> import signal <EOL> import sys <EOL> import tempfile <EOL> import traceback <EOL> import hashlib <EOL> logging . basicConfig ( <EOL> level = logging . INFO , <EOL> format = '<STR_LIT>' ) <EOL> from google . appengine . api import yaml_errors <EOL> from google . appengine . dist import py_zipimport <EOL> from google . appengine . tools import appcfg <EOL> from google . appengine . tools import appengine_rpc <EOL> from google . appengine . tools import dev_appserver <EOL> from google . appengine . tools import dev_appserver_multiprocess as multiprocess <EOL> DEFAULT_ADMIN_CONSOLE_SERVER = '<STR_LIT>' <EOL> ARG_ADDRESS = '<STR_LIT:address>' <EOL> ARG_ADMIN_CONSOLE_HOST = '<STR_LIT>' <EOL> ARG_ADMIN_CONSOLE_SERVER = '<STR_LIT>' <EOL> ARG_ALLOW_SKIPPED_FILES = '<STR_LIT>' <EOL> ARG_AUTH_DOMAIN = '<STR_LIT>' <EOL> ARG_BACKENDS = '<STR_LIT>' <EOL> ARG_BLOBSTORE_PATH = '<STR_LIT>' <EOL> ARG_CLEAR_DATASTORE = '<STR_LIT>' <EOL> ARG_CLEAR_PROSPECTIVE_SEARCH = '<STR_LIT>' <EOL> ARG_DATASTORE_PATH = '<STR_LIT>' <EOL> ARG_DEBUG_IMPORTS = '<STR_LIT>' <EOL> ARG_DEFAULT_PARTITION = '<STR_LIT>' <EOL> ARG_DISABLE_TASK_RUNNING = '<STR_LIT>' <EOL> ARG_ENABLE_SENDMAIL = '<STR_LIT>' <EOL> ARG_HIGH_REPLICATION = '<STR_LIT>' <EOL> ARG_HISTORY_PATH = '<STR_LIT>' <EOL> ARG_LOGIN_URL = '<STR_LIT>' <EOL> ARG_LOG_LEVEL = '<STR_LIT>' <EOL> ARG_MULTIPROCESS = multiprocess . ARG_MULTIPROCESS <EOL> ARG_MULTIPROCESS_API_PORT = multiprocess . ARG_MULTIPROCESS_API_PORT <EOL> ARG_MULTIPROCESS_API_SERVER = multiprocess . ARG_MULTIPROCESS_API_SERVER <EOL> ARG_MULTIPROCESS_APP_INSTANCE_ID = multiprocess . ARG_MULTIPROCESS_APP_INSTANCE_ID <EOL> ARG_MULTIPROCESS_BACKEND_ID = multiprocess . ARG_MULTIPROCESS_BACKEND_ID <EOL> ARG_MULTIPROCESS_BACKEND_INSTANCE_ID = multiprocess . ARG_MULTIPROCESS_BACKEND_INSTANCE_ID <EOL> ARG_MULTIPROCESS_MIN_PORT = multiprocess . ARG_MULTIPROCESS_MIN_PORT <EOL> ARG_MYSQL_HOST = '<STR_LIT>' <EOL> ARG_MYSQL_PASSWORD = '<STR_LIT>' <EOL> ARG_MYSQL_PORT = '<STR_LIT>' <EOL> ARG_MYSQL_SOCKET = '<STR_LIT>' <EOL> ARG_MYSQL_USER = '<STR_LIT>' <EOL> ARG_PERSIST_LOGS = '<STR_LIT>' <EOL> ARG_PORT = '<STR_LIT:port>' <EOL> ARG_PROSPECTIVE_SEARCH_PATH = '<STR_LIT>' <EOL> ARG_REQUIRE_INDEXES = '<STR_LIT>' <EOL> ARG_SHOW_MAIL_BODY = '<STR_LIT>' <EOL> ARG_SKIP_SDK_UPDATE_CHECK = '<STR_LIT>' <EOL> ARG_SMTP_HOST = '<STR_LIT>' <EOL> ARG_SMTP_PASSWORD = '<STR_LIT>' <EOL> ARG_SMTP_PORT = '<STR_LIT>' <EOL> ARG_SMTP_USER = '<STR_LIT>' <EOL> ARG_STATIC_CACHING = '<STR_LIT>' <EOL> ARG_TASK_RETRY_SECONDS = '<STR_LIT>' <EOL> ARG_TRUSTED = '<STR_LIT>' <EOL> ARG_USE_SQLITE = '<STR_LIT>' <EOL> ARG_LOGIN_SERVER = '<STR_LIT>' <EOL> ARG_COOKIE_SECRET = '<STR_LIT>' <EOL> ARG_NGINX_PORT = '<STR_LIT>' <EOL> ARG_NGINX_HOST = '<STR_LIT>' <EOL> ARG_XMPP_PATH = '<STR_LIT>' <EOL> ARG_UASERVER_PATH = '<STR_LIT>' <EOL> SDK_PATH = os . path . dirname ( <EOL> os . path . dirname ( <EOL> os . path . dirname ( <EOL> os . path . dirname ( os_compat . __file__ ) <EOL> ) <EOL> ) <EOL> ) <EOL> PRODUCTION_VERSION = ( <NUM_LIT:2> , <NUM_LIT:5> ) <EOL> WARN_ABOUT_PYTHON_VERSION = True <EOL> DEFAULT_ARGS = { <EOL> ARG_ADDRESS : '<STR_LIT:localhost>' , <EOL> ARG_ADMIN_CONSOLE_HOST : None , <EOL> ARG_ADMIN_CONSOLE_SERVER : DEFAULT_ADMIN_CONSOLE_SERVER , <EOL> ARG_ALLOW_SKIPPED_FILES : False , <EOL> ARG_AUTH_DOMAIN : '<STR_LIT>' , <EOL> ARG_BLOBSTORE_PATH : '<STR_LIT>' , <EOL> ARG_CLEAR_DATASTORE : False , <EOL> ARG_CLEAR_PROSPECTIVE_SEARCH : False , <EOL> ARG_DATASTORE_PATH : '<STR_LIT>' , <EOL> ARG_DEFAULT_PARTITION : '<STR_LIT>' , <EOL> ARG_DISABLE_TASK_RUNNING : False , <EOL> ARG_ENABLE_SENDMAIL : False , <EOL> ARG_HIGH_REPLICATION : False , <EOL> ARG_HISTORY_PATH : os . path . join ( tempfile . gettempdir ( ) , <EOL> '<STR_LIT>' ) , <EOL> ARG_LOGIN_URL : '<STR_LIT>' , <EOL> ARG_LOG_LEVEL : logging . INFO , <EOL> ARG_MYSQL_HOST : '<STR_LIT:localhost>' , <EOL> ARG_MYSQL_PASSWORD : '<STR_LIT>' , <EOL> ARG_MYSQL_PORT : <NUM_LIT> , <EOL> ARG_MYSQL_SOCKET : '<STR_LIT>' , <EOL> ARG_MYSQL_USER : '<STR_LIT>' , <EOL> ARG_PERSIST_LOGS : False , <EOL> ARG_PORT : <NUM_LIT> , <EOL> ARG_PROSPECTIVE_SEARCH_PATH : os . path . join ( tempfile . gettempdir ( ) , <EOL> '<STR_LIT>' ) , <EOL> ARG_REQUIRE_INDEXES : False , <EOL> ARG_SHOW_MAIL_BODY : False , <EOL> ARG_SKIP_SDK_UPDATE_CHECK : False , <EOL> ARG_SMTP_HOST : '<STR_LIT>' , <EOL> ARG_SMTP_PASSWORD : '<STR_LIT>' , <EOL> ARG_SMTP_PORT : <NUM_LIT> , <EOL> ARG_SMTP_USER : '<STR_LIT>' , <EOL> ARG_STATIC_CACHING : True , <EOL> ARG_TASK_RETRY_SECONDS : <NUM_LIT:30> , <EOL> ARG_TRUSTED : False , <EOL> ARG_USE_SQLITE : False , <EOL> ARG_LOGIN_SERVER : "<STR_LIT>" , <EOL> ARG_COOKIE_SECRET : "<STR_LIT>" , <EOL> ARG_NGINX_HOST : '<STR_LIT:127.0.0.1>' , <EOL> ARG_NGINX_PORT : '<STR_LIT>' , <EOL> } <EOL> def PrintUsageExit ( code ) : <EOL> """<STR_LIT>""" <EOL> render_dict = DEFAULT_ARGS . copy ( ) <EOL> render_dict [ '<STR_LIT>' ] = os . path . basename ( sys . argv [ <NUM_LIT:0> ] ) <EOL> print sys . modules [ '<STR_LIT:__main__>' ] . __doc__ % render_dict <EOL> sys . stdout . flush ( ) <EOL> sys . exit ( code ) <EOL> def ParseArguments ( argv ) : <EOL> """<STR_LIT>""" <EOL> option_dict = DEFAULT_ARGS . copy ( ) <EOL> try : <EOL> opts , args = getopt . gnu_getopt ( <EOL> argv [ <NUM_LIT:1> : ] , <EOL> '<STR_LIT>' , <EOL> [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> except getopt . GetoptError , e : <EOL> print >> sys . stderr , '<STR_LIT>' % e <EOL> PrintUsageExit ( <NUM_LIT:1> ) <EOL> host = "<STR_LIT:localhost>" <EOL> port = "<STR_LIT>" <EOL> nginx_port = "<STR_LIT>" <EOL> nginx_host = "<STR_LIT:localhost>" <EOL> for option , value in opts : <EOL> if option in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> PrintUsageExit ( <NUM_LIT:0> ) <EOL> if option in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> option_dict [ ARG_LOG_LEVEL ] = logging . DEBUG <EOL> if option in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> try : <EOL> option_dict [ ARG_PORT ] = int ( value ) <EOL> if not ( <NUM_LIT> > option_dict [ ARG_PORT ] > <NUM_LIT:0> ) : <EOL> raise ValueError <EOL> port = value <EOL> except ValueError : <EOL> print >> sys . stderr , '<STR_LIT>' <EOL> PrintUsageExit ( <NUM_LIT:1> ) <EOL> def expand_path ( s ) : <EOL> return os . path . abspath ( os . path . expanduser ( s ) ) <EOL> if option in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> option_dict [ ARG_ADDRESS ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_BLOBSTORE_PATH ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_DATASTORE_PATH ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_PROSPECTIVE_SEARCH_PATH ] = expand_path ( value ) <EOL> option_dict [ ARG_SKIP_SDK_UPDATE_CHECK ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_USE_SQLITE ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_HIGH_REPLICATION ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_HISTORY_PATH ] = expand_path ( value ) <EOL> if option in ( '<STR_LIT:-c>' , '<STR_LIT>' ) : <EOL> option_dict [ ARG_CLEAR_DATASTORE ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_CLEAR_PROSPECTIVE_SEARCH ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_REQUIRE_INDEXES ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MYSQL_HOST ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MYSQL_PORT ] = _ParsePort ( value , '<STR_LIT>' ) <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MYSQL_USER ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MYSQL_PASSWORD ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MYSQL_SOCKET ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_SMTP_HOST ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_SMTP_PORT ] = _ParsePort ( value , '<STR_LIT>' ) <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_SMTP_USER ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_SMTP_PASSWORD ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_ENABLE_SENDMAIL ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_SHOW_MAIL_BODY ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ '<STR_LIT>' ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ '<STR_LIT>' ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_ADMIN_CONSOLE_SERVER ] = value . strip ( ) <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_ADMIN_CONSOLE_HOST ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_ALLOW_SKIPPED_FILES ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_STATIC_CACHING ] = False <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_DISABLE_TASK_RUNNING ] = True <EOL> if option == '<STR_LIT>' : <EOL> try : <EOL> option_dict [ ARG_TASK_RETRY_SECONDS ] = int ( value ) <EOL> if option_dict [ ARG_TASK_RETRY_SECONDS ] < <NUM_LIT:0> : <EOL> raise ValueError <EOL> except ValueError : <EOL> print >> sys . stderr , '<STR_LIT>' <EOL> PrintUsageExit ( <NUM_LIT:1> ) <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_TRUSTED ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_PERSIST_LOGS ] = True <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_BACKENDS ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS_MIN_PORT ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS_API_SERVER ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS_API_PORT ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS_APP_INSTANCE_ID ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS_BACKEND_ID ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_MULTIPROCESS_BACKEND_INSTANCE_ID ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_DEFAULT_PARTITION ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ "<STR_LIT>" ] = value <EOL> option_dict [ ARG_LOGIN_SERVER ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ "<STR_LIT>" ] = value <EOL> secret = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ "<STR_LIT>" ] = value <EOL> nginx_port = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ "<STR_LIT>" ] = value <EOL> nginx_host = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_XMPP_PATH ] = value <EOL> if option == '<STR_LIT>' : <EOL> option_dict [ ARG_UASERVER_PATH ] = value <EOL> os . environ [ '<STR_LIT>' ] = host <EOL> os . environ [ '<STR_LIT>' ] = port <EOL> os . environ [ '<STR_LIT>' ] = secret <EOL> os . environ [ '<STR_LIT>' ] = nginx_host <EOL> os . environ [ '<STR_LIT>' ] = nginx_port <EOL> return args , option_dict <EOL> def _ParsePort ( port , description ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> port = int ( port ) <EOL> if not ( <NUM_LIT> > port > <NUM_LIT:0> ) : <EOL> raise ValueError <EOL> return port <EOL> except ValueError : <EOL> print >> sys . stderr , '<STR_LIT>' % ( port , description ) <EOL> PrintUsageExit ( <NUM_LIT:1> ) <EOL> def MakeRpcServer ( option_dict ) : <EOL> """<STR_LIT>""" <EOL> server = appengine_rpc . HttpRpcServer ( <EOL> option_dict [ ARG_ADMIN_CONSOLE_SERVER ] , <EOL> lambda : ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> appcfg . GetUserAgent ( ) , <EOL> appcfg . GetSourceName ( ) , <EOL> host_override = option_dict [ ARG_ADMIN_CONSOLE_HOST ] ) <EOL> server . authenticated = True <EOL> return server <EOL> def SigTermHandler ( signum , frame ) : <EOL> """<STR_LIT>""" <EOL> raise KeyboardInterrupt ( ) <EOL> def main ( argv ) : <EOL> """<STR_LIT>""" <EOL> args , option_dict = ParseArguments ( argv ) <EOL> if len ( args ) != <NUM_LIT:1> : <EOL> print >> sys . stderr , '<STR_LIT>' <EOL> PrintUsageExit ( <NUM_LIT:1> ) <EOL> root_path = args [ <NUM_LIT:0> ] <EOL> if '<STR_LIT>' in option_dict : <EOL> auth_domain = option_dict [ '<STR_LIT>' ] <EOL> dev_appserver . DEFAULT_ENV [ '<STR_LIT>' ] = auth_domain <EOL> if '<STR_LIT>' in option_dict : <EOL> enable_logging = option_dict [ '<STR_LIT>' ] <EOL> dev_appserver . HardenedModulesHook . ENABLE_LOGGING = enable_logging <EOL> if '<STR_LIT>' in option_dict : <EOL> dev_appserver . DEFAULT_ENV [ '<STR_LIT>' ] = option_dict [ '<STR_LIT>' ] <EOL> if "<STR_LIT>" in option_dict : <EOL> dev_appserver . DEFAULT_ENV [ "<STR_LIT>" ] = option_dict [ "<STR_LIT>" ] <EOL> log_level = option_dict [ ARG_LOG_LEVEL ] <EOL> option_dict [ '<STR_LIT>' ] = os . path . realpath ( root_path ) <EOL> logging . getLogger ( ) . setLevel ( log_level ) <EOL> default_partition = option_dict [ ARG_DEFAULT_PARTITION ] <EOL> appinfo = None <EOL> try : <EOL> appinfo , matcher , _ = dev_appserver . LoadAppConfig ( <EOL> root_path , { } , default_partition = default_partition ) <EOL> except yaml_errors . EventListenerError , e : <EOL> logging . error ( '<STR_LIT>' , e ) <EOL> return <NUM_LIT:1> <EOL> except dev_appserver . InvalidAppConfigError , e : <EOL> logging . error ( '<STR_LIT>' , e ) <EOL> return <NUM_LIT:1> <EOL> version_tuple = tuple ( sys . version_info [ : <NUM_LIT:2> ] ) <EOL> expected_version = PRODUCTION_VERSION <EOL> if appinfo . runtime == '<STR_LIT>' : <EOL> expected_version = ( <NUM_LIT:2> , <NUM_LIT:7> ) <EOL> if ARG_MULTIPROCESS not in option_dict and WARN_ABOUT_PYTHON_VERSION : <EOL> if version_tuple < expected_version : <EOL> sys . stderr . write ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % ( <EOL> version_tuple [ <NUM_LIT:0> ] , version_tuple [ <NUM_LIT:1> ] , <EOL> expected_version [ <NUM_LIT:0> ] , expected_version [ <NUM_LIT:1> ] ) ) <EOL> if version_tuple > expected_version : <EOL> sys . stderr . write ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' % ( <EOL> version_tuple [ <NUM_LIT:0> ] , version_tuple [ <NUM_LIT:1> ] , <EOL> expected_version [ <NUM_LIT:0> ] , expected_version [ <NUM_LIT:1> ] ) ) <EOL> multiprocess . Init ( argv , option_dict , root_path , appinfo ) <EOL> dev_process = multiprocess . GlobalProcess ( ) <EOL> port = option_dict [ ARG_PORT ] <EOL> login_url = option_dict [ ARG_LOGIN_URL ] <EOL> address = option_dict [ ARG_ADDRESS ] <EOL> require_indexes = option_dict [ ARG_REQUIRE_INDEXES ] <EOL> allow_skipped_files = option_dict [ ARG_ALLOW_SKIPPED_FILES ] <EOL> static_caching = option_dict [ ARG_STATIC_CACHING ] <EOL> persist_logs = option_dict [ ARG_PERSIST_LOGS ] <EOL> skip_sdk_update_check = option_dict [ ARG_SKIP_SDK_UPDATE_CHECK ] <EOL> if ( option_dict [ ARG_ADMIN_CONSOLE_SERVER ] != '<STR_LIT>' and <EOL> not dev_process . IsSubprocess ( ) ) : <EOL> server = MakeRpcServer ( option_dict ) <EOL> if dev_process . IsSubprocess ( ) : <EOL> logging . getLogger ( ) . setLevel ( logging . WARNING ) <EOL> try : <EOL> dev_appserver . SetupStubs ( appinfo . application , ** option_dict ) <EOL> except : <EOL> exc_type , exc_value , exc_traceback = sys . exc_info ( ) <EOL> logging . error ( str ( exc_type ) + '<STR_LIT>' + str ( exc_value ) ) <EOL> logging . debug ( '<STR_LIT>' . join ( traceback . format_exception ( <EOL> exc_type , exc_value , exc_traceback ) ) ) <EOL> return <NUM_LIT:1> <EOL> http_server = dev_appserver . CreateServer ( <EOL> root_path , <EOL> login_url , <EOL> port , <EOL> sdk_dir = SDK_PATH , <EOL> serve_address = address , <EOL> require_indexes = require_indexes , <EOL> allow_skipped_files = allow_skipped_files , <EOL> static_caching = static_caching , <EOL> default_partition = default_partition , <EOL> persist_logs = persist_logs , <EOL> secret_hash = hashlib . sha1 ( appinfo . application + '<STR_LIT:/>' + option_dict [ '<STR_LIT>' ] ) . hexdigest ( ) ) <EOL> signal . signal ( signal . SIGTERM , SigTermHandler ) <EOL> os . environ [ '<STR_LIT>' ] = appinfo . application <EOL> dev_process . PrintStartMessage ( appinfo . application , address , port ) <EOL> if dev_process . IsInstance ( ) : <EOL> logging . getLogger ( ) . setLevel ( logging . INFO ) <EOL> try : <EOL> try : <EOL> http_server . serve_forever ( ) <EOL> except KeyboardInterrupt : <EOL> if not dev_process . IsSubprocess ( ) : <EOL> logging . info ( '<STR_LIT>' ) <EOL> except : <EOL> exc_info = sys . exc_info ( ) <EOL> info_string = '<STR_LIT:\n>' . join ( traceback . format_exception ( * exc_info ) ) <EOL> logging . error ( '<STR_LIT>' , info_string ) <EOL> return <NUM_LIT:1> <EOL> finally : <EOL> http_server . server_close ( ) <EOL> finally : <EOL> done = False <EOL> while not done : <EOL> try : <EOL> multiprocess . Shutdown ( ) <EOL> done = True <EOL> except KeyboardInterrupt : <EOL> pass <EOL> return <NUM_LIT:0> <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> sys . exit ( main ( sys . argv ) ) </s>
