我试图在googleappengine中得到一个后端来运行来自taskqueue的任务。它运行时没有错误,但任务没有执行。我发现文件非常混乱。在
我的克罗恩·亚姆公司名称:
- description: backend test
url: /send_to_backend
schedule: every 2 minutes
我的应用程序yaml公司名称:
^{pr2}$我的后端.yaml公司名称:
- name: backendtest
class: B1
我的队列.yaml公司名称:
total_storage_limit: 500M
queue:
- name: test
rate: 1/s
max_concurrent_requests: 1
我的手下主.py公司名称:
class BackendHandler(webapp2.RequestHandler):
def get(self):
taskqueue.add(url='/test', target='backendtest')
class TestHandler(webapp2.RequestHandler):
def get(self):
test.test()
在中执行实际工作的函数测试.py公司名称:
def test():
company = Company()
company.name = "Advanced Micro Devices, Inc"
company.exchange = "NASDAQ"
company.put()
AMD从未进入数据库,我很茫然。我这样做对吗?后端和任务队列是这样一起工作的吗?在
是的,后端和任务队列是这样一起工作的。在
不幸的是,您没有发布完全可运行的示例,所以很难说您需要多少修复。您肯定需要的一个修复方法是在TestHandler中更改get->;post(队列任务处理是通过post完成的)
下面是示例的完全可运行和工作版本。别忘了“The development server doesn't automatically run your cron jobs”,所以在开发环境中用curl试试:
在应用程序yaml在
在后端.yaml在
^{pr2}$在克罗恩·亚姆在
在主.py在
在队列.yaml在
在测试.py在
相关问题 更多 >
编程相关推荐