thirdparty/google_appengine/google/appengine/tools/dev_appserver_main.py
changeset 2273 e4cb9c53db3e
parent 2172 ac7bd3b467ff
child 2413 d0b7dac5325c
equal deleted inserted replaced
2272:26491ee91e33 2273:e4cb9c53db3e
    78 
    78 
    79   This function should not be called until sys.path has been properly set.
    79   This function should not be called until sys.path has been properly set.
    80   """
    80   """
    81   global yaml_errors, appcfg, appengine_rpc, dev_appserver, os_compat
    81   global yaml_errors, appcfg, appengine_rpc, dev_appserver, os_compat
    82   from google.appengine.api import yaml_errors
    82   from google.appengine.api import yaml_errors
       
    83   from google.appengine.dist import py_zipimport
    83   from google.appengine.tools import appcfg
    84   from google.appengine.tools import appcfg
    84   from google.appengine.tools import appengine_rpc
    85   from google.appengine.tools import appengine_rpc
    85   from google.appengine.tools import dev_appserver
    86   from google.appengine.tools import dev_appserver
    86   from google.appengine.tools import os_compat
    87   from google.appengine.tools import os_compat
    87 
    88 
   108 ARG_SMTP_PASSWORD = 'smtp_password'
   109 ARG_SMTP_PASSWORD = 'smtp_password'
   109 ARG_SMTP_PORT = 'smtp_port'
   110 ARG_SMTP_PORT = 'smtp_port'
   110 ARG_SMTP_USER = 'smtp_user'
   111 ARG_SMTP_USER = 'smtp_user'
   111 ARG_STATIC_CACHING = 'static_caching'
   112 ARG_STATIC_CACHING = 'static_caching'
   112 ARG_TEMPLATE_DIR = 'template_dir'
   113 ARG_TEMPLATE_DIR = 'template_dir'
       
   114 ARG_TRUSTED = 'trusted'
   113 
   115 
   114 SDK_PATH = os.path.dirname(
   116 SDK_PATH = os.path.dirname(
   115              os.path.dirname(
   117              os.path.dirname(
   116                os.path.dirname(
   118                os.path.dirname(
   117                  os.path.dirname(os_compat.__file__)
   119                  os.path.dirname(os_compat.__file__)
   140   ARG_ADDRESS: 'localhost',
   142   ARG_ADDRESS: 'localhost',
   141   ARG_ADMIN_CONSOLE_SERVER: DEFAULT_ADMIN_CONSOLE_SERVER,
   143   ARG_ADMIN_CONSOLE_SERVER: DEFAULT_ADMIN_CONSOLE_SERVER,
   142   ARG_ADMIN_CONSOLE_HOST: None,
   144   ARG_ADMIN_CONSOLE_HOST: None,
   143   ARG_ALLOW_SKIPPED_FILES: False,
   145   ARG_ALLOW_SKIPPED_FILES: False,
   144   ARG_STATIC_CACHING: True,
   146   ARG_STATIC_CACHING: True,
       
   147   ARG_TRUSTED: False,
   145 }
   148 }
   146 
   149 
   147 API_PATHS = {'1':
   150 API_PATHS = {'1':
   148              {'google': (),
   151              {'google': (),
   149               'antlr3': ('lib', 'antlr3'),
   152               'antlr3': ('lib', 'antlr3'),
   265         'smtp_host=',
   268         'smtp_host=',
   266         'smtp_password=',
   269         'smtp_password=',
   267         'smtp_port=',
   270         'smtp_port=',
   268         'smtp_user=',
   271         'smtp_user=',
   269         'template_dir=',
   272         'template_dir=',
       
   273         'trusted',
   270       ])
   274       ])
   271   except getopt.GetoptError, e:
   275   except getopt.GetoptError, e:
   272     print >>sys.stderr, 'Error: %s' % e
   276     print >>sys.stderr, 'Error: %s' % e
   273     PrintUsageExit(1)
   277     PrintUsageExit(1)
   274 
   278 
   345     if option == '--allow_skipped_files':
   349     if option == '--allow_skipped_files':
   346       option_dict[ARG_ALLOW_SKIPPED_FILES] = True
   350       option_dict[ARG_ALLOW_SKIPPED_FILES] = True
   347 
   351 
   348     if option == '--disable_static_caching':
   352     if option == '--disable_static_caching':
   349       option_dict[ARG_STATIC_CACHING] = False
   353       option_dict[ARG_STATIC_CACHING] = False
       
   354 
       
   355     if option == '--trusted':
       
   356       option_dict[ARG_TRUSTED] = True
   350 
   357 
   351   return args, option_dict
   358   return args, option_dict
   352 
   359 
   353 
   360 
   354 def MakeRpcServer(option_dict):
   361 def MakeRpcServer(option_dict):
   410   allow_skipped_files = option_dict[ARG_ALLOW_SKIPPED_FILES]
   417   allow_skipped_files = option_dict[ARG_ALLOW_SKIPPED_FILES]
   411   static_caching = option_dict[ARG_STATIC_CACHING]
   418   static_caching = option_dict[ARG_STATIC_CACHING]
   412 
   419 
   413   logging.basicConfig(
   420   logging.basicConfig(
   414     level=log_level,
   421     level=log_level,
   415     format='%(levelname)-8s %(asctime)s %(filename)s] %(message)s')
   422     format='%(levelname)-8s %(asctime)s %(filename)s:%(lineno)s] %(message)s')
   416 
   423 
   417   config = None
   424   config = None
   418   try:
   425   try:
   419     config, matcher = dev_appserver.LoadAppConfig(root_path, {})
   426     config, matcher = dev_appserver.LoadAppConfig(root_path, {})
   420   except yaml_errors.EventListenerError, e:
   427   except yaml_errors.EventListenerError, e: