python - 无法在 gae 中运行简单的 helloworld (python 2.7)

标签 python google-app-engine

我正在尝试运行 official helloworld适用于 python 2.7 的 google-appengine 1.6.4 中的程序。

无法运行一个简单的 helloworld 真是令人沮丧。如果能提供任何帮助,我将不胜感激。

我遇到的错误:-

shadyabhi@MBP-archlinux ~/codes/gae $ dev_appserver.py helloworld/
INFO     2012-04-06 23:25:55,030 appengine_rpc.py:160] Server: appengine.google.com
INFO     2012-04-06 23:25:55,034 appcfg.py:582] Checking for updates to the SDK.
INFO     2012-04-06 23:25:56,709 appcfg.py:616] This SDK release is newer than the advertised release.
WARNING  2012-04-06 23:25:56,710 datastore_file_stub.py:513] Could not read datastore data from /tmp/dev_appserver.datastore
INFO     2012-04-06 23:25:56,773 dev_appserver_multiprocess.py:647] Running application dev~helloworld on port 8080: http://localhost:8080
INFO     2012-04-06 23:25:56,774 dev_appserver_multiprocess.py:649] Admin console is available at: http://localhost:8080/_ah/admin
WARNING  2012-04-06 23:26:00,928 py_zipimport.py:139] Can't open zipfile /usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info: IOError: [Errno 13] file not accessible: '/usr/lib/python2.7/site-packages/setuptools-0.6c11.egg-info'
ERROR    2012-04-06 23:26:01,101 wsgi.py:189] 
Traceback (most recent call last):
  File "/opt/google-appengine-python/google/appengine/runtime/wsgi.py", line 187, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/opt/google-appengine-python/google/appengine/runtime/wsgi.py", line 239, in _LoadHandler
    raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'helloworld' from '/home/shadyabhi/codes/gae/helloworld/helloworld.pyc'> has no attribute app
INFO     2012-04-06 23:26:01,110 dev_appserver.py:2884] "GET / HTTP/1.1" 500 -
ERROR    2012-04-06 23:26:01,479 wsgi.py:189] 
Traceback (most recent call last):
  File "/opt/google-appengine-python/google/appengine/runtime/wsgi.py", line 187, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/opt/google-appengine-python/google/appengine/runtime/wsgi.py", line 239, in _LoadHandler
    raise ImportError('%s has no attribute %s' % (handler, name))
ImportError: <module 'helloworld' from '/home/shadyabhi/codes/gae/helloworld/helloworld.pyc'> has no attribute app
INFO     2012-04-06 23:26:01,486 dev_appserver.py:2884] "GET /favicon.ico HTTP/1.1" 500 -

最佳答案

如果您使用的是 python2.7 库,则教程有错误

此行不正确:

application = webapp2.WSGIApplication([('/', MainPage)], debug=True)

正确的行应该是:

app = webapp2.WSGIApplication([('/', MainPage)], debug=True)

WSGI 处理程序正在提示,因为它正在寻找一个名为“app”的属性。

关于python - 无法在 gae 中运行简单的 helloworld (python 2.7),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10056861/

相关文章:

python - 查找特定字典键具有特定值的所有行

python - 在 SQLAlchemy 中获取传感器的每种类型的最新读取值

java - Google App Engine - 已删除的实体未删除

google-app-engine - Google Datastore,获取特定的实体属性

python - Bokeh 与 Google App Engine 兼容吗?

java - 在 Google 应用引擎中按 id desc 排序

python - 如何在 Python 中使用 Zipfile 压缩具有扁平目录结构的文件?

java - 无法使用 Java 进程执行参数包含 #(哈希)字符的 python 可执行文件

Python 请求超时不适合网站流式传输

java - 如何在 Eclipse for Google App Engine 中从 Java 7 切换到 Java 6?