当我发出POST请求时,我正试图获取一个事件。这是代码:
from eve import Eve
def before_insert(response):
print 'About to return artists'
app = Eve(settings='settings.py')
app.on_insert += before_insert
if __name__ == '__main__':
app.run()
我在设置文件中没有代码来容纳事件 - 只是标准的东西在我删除行时工作正常: app.on_insert + = before_insert
当我做POST时,我得到:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
当我对资源进行GET时,我得到数据但是没有添加POST ...
日wassup ??
答案 0 :(得分:1)
看起来您的回调函数签名错误。请尝试以下方法。
from eve import Eve
def before_insert(resource_name, items):
print 'About to return artists'
app = Eve(settings='settings.py')
app.on_insert += before_insert
if __name__ == '__main__':
app.run(debug=True)
在任何情况下,请尝试在设置文件中使用DEBUG = True
运行应用,或使用app.run(debug=True)
运行该应用,这样您就可以获得实际问题的提示。