404在App Engine上使用Cron作业
问题描述:
因此,当我尝试部署我的应用程序时,我收到了此。以下是弥补我的应用程序文件:404在App Engine上使用Cron作业
main.py:
import webapp2
class MainHandler(webapp2.RequestHandler):
def get(self):
self.response.write("<h1>Duracron!</h1>")
class EventHandler(webapp2.RequestHandler):
def get(self):
self.response.write("<h1>Duracsron!</h1>")
app = webapp2.WSGIApplication([
('/', MainHandler),
('/event/.*', EventHandler),
], debug=True)
的app.yaml:
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /.*
script: main.app
libraries:
- name: webapp2
version: "2.5.2"
- name: ssl
version: latest
cron.yaml:
cron:
- description: test task
url: /events/test
schedule: every 1 minutes
我可以” t似乎发现了什么问题。根据我的理解,cron.yaml
将向/events/test
和app.yaml
发送请求,将其重定向至main.app
,main.app
将其路由至EventsHandler()
。我错过了什么?
答
它看起来像字母event
中的一个错字,它与events
不匹配,可能是问题的原因。尝试将('/event/.*', EventHandler),
更改为('/events/.*', EventHandler),
,以便它与您的cron.yaml