thirdparty/google_appengine/google/appengine/tools/dev_appserver_main.py
changeset 2172 ac7bd3b467ff
parent 1278 a7766286a7be
child 2273 e4cb9c53db3e
equal deleted inserted replaced
2171:83d96aadd228 2172:ac7bd3b467ff
    52   --auth_domain              Authorization domain that this app runs in.
    52   --auth_domain              Authorization domain that this app runs in.
    53                              (Default gmail.com)
    53                              (Default gmail.com)
    54   --debug_imports            Enables debug logging for module imports, showing
    54   --debug_imports            Enables debug logging for module imports, showing
    55                              search paths used for finding modules and any
    55                              search paths used for finding modules and any
    56                              errors encountered during the import process.
    56                              errors encountered during the import process.
       
    57   --allow_skipped_files      Allow access to files matched by app.yaml's
       
    58                              skipped_files (default False)
    57   --disable_static_caching   Never allow the browser to cache static files.
    59   --disable_static_caching   Never allow the browser to cache static files.
    58                              (Default enable if expiration set in app.yaml)
    60                              (Default enable if expiration set in app.yaml)
    59 """
    61 """
    60 
    62 
    61 
    63 
    99 ARG_HISTORY_PATH = 'history_path'
   101 ARG_HISTORY_PATH = 'history_path'
   100 ARG_LOGIN_URL = 'login_url'
   102 ARG_LOGIN_URL = 'login_url'
   101 ARG_LOG_LEVEL = 'log_level'
   103 ARG_LOG_LEVEL = 'log_level'
   102 ARG_PORT = 'port'
   104 ARG_PORT = 'port'
   103 ARG_REQUIRE_INDEXES = 'require_indexes'
   105 ARG_REQUIRE_INDEXES = 'require_indexes'
       
   106 ARG_ALLOW_SKIPPED_FILES = 'allow_skipped_files'
   104 ARG_SMTP_HOST = 'smtp_host'
   107 ARG_SMTP_HOST = 'smtp_host'
   105 ARG_SMTP_PASSWORD = 'smtp_password'
   108 ARG_SMTP_PASSWORD = 'smtp_password'
   106 ARG_SMTP_PORT = 'smtp_port'
   109 ARG_SMTP_PORT = 'smtp_port'
   107 ARG_SMTP_USER = 'smtp_user'
   110 ARG_SMTP_USER = 'smtp_user'
   108 ARG_STATIC_CACHING = 'static_caching'
   111 ARG_STATIC_CACHING = 'static_caching'
   135   ARG_SHOW_MAIL_BODY: False,
   138   ARG_SHOW_MAIL_BODY: False,
   136   ARG_AUTH_DOMAIN: 'gmail.com',
   139   ARG_AUTH_DOMAIN: 'gmail.com',
   137   ARG_ADDRESS: 'localhost',
   140   ARG_ADDRESS: 'localhost',
   138   ARG_ADMIN_CONSOLE_SERVER: DEFAULT_ADMIN_CONSOLE_SERVER,
   141   ARG_ADMIN_CONSOLE_SERVER: DEFAULT_ADMIN_CONSOLE_SERVER,
   139   ARG_ADMIN_CONSOLE_HOST: None,
   142   ARG_ADMIN_CONSOLE_HOST: None,
       
   143   ARG_ALLOW_SKIPPED_FILES: False,
   140   ARG_STATIC_CACHING: True,
   144   ARG_STATIC_CACHING: True,
   141 }
   145 }
   142 
   146 
   143 API_PATHS = {'1':
   147 API_PATHS = {'1':
   144              {'google': (),
   148              {'google': (),
   243       argv[1:],
   247       argv[1:],
   244       'a:cdhp:',
   248       'a:cdhp:',
   245       [ 'address=',
   249       [ 'address=',
   246         'admin_console_server=',
   250         'admin_console_server=',
   247         'admin_console_host=',
   251         'admin_console_host=',
       
   252         'allow_skipped_files',
   248         'auth_domain=',
   253         'auth_domain=',
   249         'clear_datastore',
   254         'clear_datastore',
   250         'datastore_path=',
   255         'datastore_path=',
   251         'debug',
   256         'debug',
   252         'debug_imports',
   257         'debug_imports',
   335       option_dict[ARG_ADMIN_CONSOLE_SERVER] = value.strip()
   340       option_dict[ARG_ADMIN_CONSOLE_SERVER] = value.strip()
   336 
   341 
   337     if option == '--admin_console_host':
   342     if option == '--admin_console_host':
   338       option_dict[ARG_ADMIN_CONSOLE_HOST] = value
   343       option_dict[ARG_ADMIN_CONSOLE_HOST] = value
   339 
   344 
       
   345     if option == '--allow_skipped_files':
       
   346       option_dict[ARG_ALLOW_SKIPPED_FILES] = True
       
   347 
   340     if option == '--disable_static_caching':
   348     if option == '--disable_static_caching':
   341       option_dict[ARG_STATIC_CACHING] = False
   349       option_dict[ARG_STATIC_CACHING] = False
   342 
   350 
   343   return args, option_dict
   351   return args, option_dict
   344 
   352 
   397   datastore_path = option_dict[ARG_DATASTORE_PATH]
   405   datastore_path = option_dict[ARG_DATASTORE_PATH]
   398   login_url = option_dict[ARG_LOGIN_URL]
   406   login_url = option_dict[ARG_LOGIN_URL]
   399   template_dir = option_dict[ARG_TEMPLATE_DIR]
   407   template_dir = option_dict[ARG_TEMPLATE_DIR]
   400   serve_address = option_dict[ARG_ADDRESS]
   408   serve_address = option_dict[ARG_ADDRESS]
   401   require_indexes = option_dict[ARG_REQUIRE_INDEXES]
   409   require_indexes = option_dict[ARG_REQUIRE_INDEXES]
       
   410   allow_skipped_files = option_dict[ARG_ALLOW_SKIPPED_FILES]
   402   static_caching = option_dict[ARG_STATIC_CACHING]
   411   static_caching = option_dict[ARG_STATIC_CACHING]
   403 
   412 
   404   logging.basicConfig(
   413   logging.basicConfig(
   405     level=log_level,
   414     level=log_level,
   406     format='%(levelname)-8s %(asctime)s %(filename)s] %(message)s')
   415     format='%(levelname)-8s %(asctime)s %(filename)s] %(message)s')
   430     logging.error(str(exc_type) + ': ' + str(exc_value))
   439     logging.error(str(exc_type) + ': ' + str(exc_value))
   431     logging.debug(''.join(traceback.format_exception(
   440     logging.debug(''.join(traceback.format_exception(
   432           exc_type, exc_value, exc_traceback)))
   441           exc_type, exc_value, exc_traceback)))
   433     return 1
   442     return 1
   434 
   443 
   435   http_server = dev_appserver.CreateServer(root_path,
   444   http_server = dev_appserver.CreateServer(
   436                                            login_url,
   445       root_path,
   437                                            port,
   446       login_url,
   438                                            template_dir,
   447       port,
   439                                            sdk_dir=SDK_PATH,
   448       template_dir,
   440                                            serve_address=serve_address,
   449       sdk_dir=SDK_PATH,
   441                                            require_indexes=require_indexes,
   450       serve_address=serve_address,
   442                                            static_caching=static_caching)
   451       require_indexes=require_indexes,
       
   452       allow_skipped_files=allow_skipped_files,
       
   453       static_caching=static_caching)
   443 
   454 
   444   logging.info('Running application %s on port %d: http://%s:%d',
   455   logging.info('Running application %s on port %d: http://%s:%d',
   445                config.application, port, serve_address, port)
   456                config.application, port, serve_address, port)
   446   try:
   457   try:
   447     try:
   458     try: