App Engine上的Flask和Python的电子报告配置问题

时间:2014-05-12 12:27:49

标签: google-app-engine flask

我在Google App Engine上运行了一个Flask应用。我正在尝试按照此link中的说明配置ereporter。

当我尝试使用dev_appserver.py

运行我的应用时出现以下错误
Traceback (most recent call last):
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 82, in <module>
    _run_file(__file__, globals())
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/dev_appserver.py", line 78, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1001, in <module>
    main()
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 994, in main
    dev_server.start(options)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 754, in start
    options.config_paths)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 632, in __init__
    module_configuration = ModuleConfiguration(config_path)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 97, in __init__
    self._config_path)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 316, in _parse_configuration
    config, files = appinfo_includes.ParseAndReturnIncludePaths(f)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo_includes.py", line 81, in ParseAndReturnIncludePaths
    appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/appinfo.py", line 1873, in LoadSingleAppInfo
    listener.Parse(app_info)
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
    self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
  File "/Users/xxx/google-cloud-sdk/platform/google_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
    raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: threadsafe cannot be enabled with CGI handler: $PYTHON_LIB/google/appengine/ext/ereporter/report_generator.py
  in "cfc-melbourne/app.yaml", line 51, column 1

的app.yaml

# Handlers tell app engine how to route requests to your application.
handlers:
# This handler configures cron.yaml
- url: /_ereporter.*
  script: $PYTHON_LIB/google/appengine/ext/ereporter/report_generator.py
  login: admin

cron.yaml

cron:
- description: Daily exception report
  url: /_ereporter?sender=xxx.xxx@gmail.com&delete=false&date=dd-mmm-yyyy  # The sender must be an app admin.
  schedule: every day 22:05

main.py

from google.appengine.ext import ereporter
ereporter.register_logger()

我错过了什么?

1 个答案:

答案 0 :(得分:0)

问题不是烧瓶,问题是过时的文档,因为显示的配置适用于线程安全为false的应用程序。对于线程安全为true的应用程序,配置在

之下
- url: /_ereporter.*
  script: google.appengine.ext.ereporter.report_generator.application
  login: admin

此信息取自https://groups.google.com/forum/#!topic/google-appengine/0v9KqB5Q8sQ