Google App Engine,Web2Py和Cron无法为url错误的属性赋值

时间:2015-05-10 02:14:00

标签: python google-app-engine cron web2py

我在为Web2Py应用程序创建Google App Engine Cron任务时遇到了一些麻烦。我查看了GAE Cron的说明,这是我作为测试创建的任务:

我的cron.yaml文件与app.yaml位于同一目录中, 我的python控制器的路径是applications / data / default,和 访问该功能的网址是myapp.appspot.com/data/default/test。

这是我的cron任务条目:

cron:
- description: test
  url: data/default/test
  schedule: every 2 minutes synchronized

但是,当我尝试部署时,我收到此错误:

Unable to assign value 'data/default/test' to attribute 'url':
Value 'data/default/test' for url does not match expression '^(?:^/.*$)$'

这是我的app.yaml文件的处理程序部分:

handlers:

# Warning! Static mapping - below - isn't compatible with 
# the parametric router's language logic. 
# You cannot use them together.

- url: /(.+?)/static/_(\d+\.\d+\.\d+)\/(.+)
  static_files: applications/\1/static/\3
  upload: applications/(.+?)/static/(.+)
  secure: optional
  expiration: "365d"

- url: /(.+?)/static/(.+)
  static_files: applications/\1/static/\2
  upload: applications/(.+?)/static/(.+)
  secure: optional

- url: /favicon.ico
  static_files: applications/welcome/static/favicon.ico
  upload: applications/welcome/static/favicon.ico

- url: /robots.txt
  static_files: applications/welcome/static/robots.txt
  upload: applications/welcome/static/robots.txt

- url: .*
  script: gaehandler.wsgiapp    # WSGI (Python 2.7 only)
  secure: optional

我在这里很丢失,因为我对谷歌应用引擎或web2py并不太熟悉。任何帮助将不胜感激

1 个答案:

答案 0 :(得分:2)

你的cron.yaml url规范中缺少一个斜杠:

cron:
- description: test
  url: /data/default/test
  schedule: every 2 minutes synchronized