Werkzeug响应对象不可迭代

时间:2013-10-14 18:21:59

标签: python google-app-engine flask werkzeug

我正在使用 Google应用引擎 webapps run_wsgi_app 实用程序来封装我的烧瓶应用实例,我认为这是一个webapp问题,因为只有烧瓶它才能正常工作。它发生在API路由上的POST请求之后

ERROR    2013-10-14 18:18:53,862 cgi.py:121] Traceback (most recent call last):
  File "/home/synod/Desktop/MedApp/GAE-app/main.py", line 4, in <module>
    run_wsgi_app(app)
  File "/usr/lib/google_appengine/google/appengine/ext/webapp/util.py", line 98, in run_wsgi_app
    run_bare_wsgi_app(add_wsgi_middleware(application))
  File "/usr/lib/google_appengine/google/appengine/ext/webapp/util.py", line 118, in run_bare_wsgi_app
    for data in result:
  File "/home/synod/Desktop/MedApp/GAE-app/werkzeug/wsgi.py", line 508, in next
    return self._next()
  File "/home/synod/Desktop/MedApp/GAE-app/werkzeug/wrappers.py", line 789, in iter_encoded
    for item in self.response:
TypeError: 'Response' object is not iterable

INFO     2013-10-14 18:18:53,869 module.py:599] default: "POST /api/betaMember/ HTTP/1.1" 500 -

@app.route('/api/betaMember/', methods=['POST'])
def betaMember():
    if not request.json:
        abort(400)

    if request.headers['Content-Type'] != 'application/json':
        abort(400)

    if not 'email' in request.json:
        abort(400)

    if not 'name' in request.json:
        abort(400)

    name = request.json.get('name')
    email = request.json.get('email')

    # person = Person(email = email,name = name)            
    # person.put()

    return make_response(jsonify({"OK": "Data Saved"}), 201)

0 个答案:

没有答案