将GAE应用程序迁移到Python 2.7后出现wsgi.py错误

时间:2012-02-28 17:08:07

标签: python django google-app-engine

在继承了传统的谷歌应用引擎应用之后,我刚从PHP开始使用Python。我已经尝试过各种在线教程后迁移到python 2.7,但是我已经超出了我的深度,下面的错误。这与我如何调用GAE或Django api有关吗?

...
runtime: python27
api_version: 1
threadsafe: yes

builtins:
- remote_api: on

inbound_services:
- warmup


libraries:
- name: django
  version: "1.2"  
...

我还有

from google.appengine.ext.webapp.util import run_wsgi_app

在我的代码中,是否应将其更改为内置?

ERROR    2012-02-28 16:31:00,167 wsgi.py:205] 
Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-        default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line     193, in Handle
    result = handler(self._environ, self._StartResponse)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/core/handlers/wsgi.py", line 248, in __call__
    response = self.get_response(request)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django_1_2/django/core/handlers/base.py", line 141, in get_response
    return self.handle_uncaught_exception(request, resolver, sys.exc_info())
UnboundLocalError: local variable 'resolver' referenced before assignment
INFO     2012-02-28 16:31:00,178 dev_appserver.py:2884] "GET /ibi/index.html HTTP/1.1" 500 -

1 个答案:

答案 0 :(得分:2)

不要在Python 2.7运行时中使用run_wsgi_app。在app.yaml中,您必须引用实际的WSGI应用程序对象。

请参阅documentation here了解如何正确配置Django