GAE Cron 的 Django HTTP 响应对象
我正在使用 Django / GAE / Python 环境执行此操作:
cron:
#run events every 12 hours
并
def events(request):
# read all records
# Do some processing on a few records
return http.HTTPResponseGone('Some Records are modified' )
在生产中得到结果: 作业按时运行,但出现“失败”消息 但是,它已按照要求在数据存储上完全完成了工作 没有看到错误日志条目 开发人员:没有错误;返回消息“某些记录已修改”
是否可以避免返回 HTTP 响应?对我来说不需要 HTTPResponse,但是,我保留了它,因为如果没有 HTTPResponse,开发服务器测试就会失败。可以有一个吗 帮我使代码干净吗?
I am doing this using Django / GAE / Python environment:
cron:
#run events every 12 hours
and
def events(request):
# read all records
# Do some processing on a few records
return http.HTTPResponseGone('Some Records are modified' )
Result in production :
Job runs on time with 'failed' message
However, it has done the job exactly on the datastore as required
No error log entry seen
Dev : No errors ; returns the message 'Some Records are modified'
Is it possible to avoid HTTP Response returned ? There is no need for HTTPResponse for me, however, I have kept this as Dev server testing fails in its absence. Can some one
help me to make the code clean?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误 410 已消失。如果操作成功,您应该返回 200 Success。当您返回
HttpResponse
时,默认状态为200。Gone is error 410. You should return 200 Success if the operation succeeds. When you return
HttpResponse
, the default status is 200.