Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 为什么cron会失败?_Python_Google App Engine - Fatal编程技术网

Python 为什么cron会失败?

Python 为什么cron会失败?,python,google-app-engine,Python,Google App Engine,因此,我有这两个cron作业(但正如您从屏幕上看到的,它们失败了,但我在日志中没有看到任何异常): 路由处理程序: app = webapp2.WSGIApplication([ ('/', MainHandler), ('/cron/addtask', AddTaskHandler), ('/cron/refreshInfo', RefreshHandler), ], debug=True) util.run_wsgi_app(app) application

因此,我有这两个cron作业(但正如您从屏幕上看到的,它们失败了,但我在日志中没有看到任何异常):

路由处理程序:

app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/cron/addtask', AddTaskHandler),
    ('/cron/refreshInfo', RefreshHandler),
   ], debug=True)
util.run_wsgi_app(app)
application: **********
version: 3
runtime: python27
api_version: 1
threadsafe: no

handlers:
- url: /static
  static_dir: static

- url: /favicon\.ico
  static_files: static/img/favicon.ico
  upload: static/img/favicon\.ico

- url: /humans\.txt
  static_files: static/txt/humans.txt
  upload: static/txt/humans\.txt

- url: /robots\.txt
  static_files: static/txt/robots.txt
  upload: static/txt/robots\.txt

- url: /.*
  script: main.py

- url: /tasks/popularityUpdate
  script: main.py

- url: /tasks/Recalculation
  script: main.py

- url: /tasks/weatherUpdate
  script: main.py

- url: /cron/addtask
  script: main.py

- url: /cron/refreshInfo
  script: main.py

builtins:
- appstats: on
cron:
- description: addTaskToTheQueue
  url: /cron/addtask
  schedule: every 3 hours

- description: refreshInformation
  url: /cron/refreshInfo
  schedule: every 24 hours
APP.YAML:

app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/cron/addtask', AddTaskHandler),
    ('/cron/refreshInfo', RefreshHandler),
   ], debug=True)
util.run_wsgi_app(app)
application: **********
version: 3
runtime: python27
api_version: 1
threadsafe: no

handlers:
- url: /static
  static_dir: static

- url: /favicon\.ico
  static_files: static/img/favicon.ico
  upload: static/img/favicon\.ico

- url: /humans\.txt
  static_files: static/txt/humans.txt
  upload: static/txt/humans\.txt

- url: /robots\.txt
  static_files: static/txt/robots.txt
  upload: static/txt/robots\.txt

- url: /.*
  script: main.py

- url: /tasks/popularityUpdate
  script: main.py

- url: /tasks/Recalculation
  script: main.py

- url: /tasks/weatherUpdate
  script: main.py

- url: /cron/addtask
  script: main.py

- url: /cron/refreshInfo
  script: main.py

builtins:
- appstats: on
cron:
- description: addTaskToTheQueue
  url: /cron/addtask
  schedule: every 3 hours

- description: refreshInformation
  url: /cron/refreshInfo
  schedule: every 24 hours
CRON.YAML:

app = webapp2.WSGIApplication([
    ('/', MainHandler),
    ('/cron/addtask', AddTaskHandler),
    ('/cron/refreshInfo', RefreshHandler),
   ], debug=True)
util.run_wsgi_app(app)
application: **********
version: 3
runtime: python27
api_version: 1
threadsafe: no

handlers:
- url: /static
  static_dir: static

- url: /favicon\.ico
  static_files: static/img/favicon.ico
  upload: static/img/favicon\.ico

- url: /humans\.txt
  static_files: static/txt/humans.txt
  upload: static/txt/humans\.txt

- url: /robots\.txt
  static_files: static/txt/robots.txt
  upload: static/txt/robots\.txt

- url: /.*
  script: main.py

- url: /tasks/popularityUpdate
  script: main.py

- url: /tasks/Recalculation
  script: main.py

- url: /tasks/weatherUpdate
  script: main.py

- url: /cron/addtask
  script: main.py

- url: /cron/refreshInfo
  script: main.py

builtins:
- appstats: on
cron:
- description: addTaskToTheQueue
  url: /cron/addtask
  schedule: every 3 hours

- description: refreshInformation
  url: /cron/refreshInfo
  schedule: every 24 hours
所以我的问题是-gae将其显示为失败的原因是什么

  • 您应该将catch all处理程序(/.*)放在app.yaml中处理程序部分的末尾
  • 在浏览器中测试basic/cron/addTask是否有效
    • 您可以访问添加到任务队列的URL(即/tasks/popularityUpdate)吗
    • 当您手动输入cron作业url时,它是否执行了预期的操作
    • 管理控制台中的日志没有显示任何错误(在cron请求上)
    • 为什么在cron作业处理程序(
      AddTaskHandler
      )的末尾有重定向?尝试删除它

    …弗雷德里克

    1。我这样做了,但没有帮助。2.它在浏览器中工作,我被重定向到(/)3。向下滚动,你会看到路由:)@LukasŠalkauskas My bad,你能在末尾用/*发布更新app.yaml吗?重定向是个问题。