我正在尝试使用此tutorial让GAango在GAE上运行。
当我运行 python manage.py runserver 时,我得到下面的堆栈跟踪。我是django和python的新手,所以我不知道接下来的步骤是什么(这是Ubuntu Jaunty btw)。似乎django没有找到SDK 1.3.1附带的GAE模块ipaddr。
如何让django找到这个模块?
/home/username/bin/google_appengine/google/appengine/api/datastore_file_stub.py:40: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
/home/username/bin/google_appengine/google/appengine/api/memcache/__init__.py:31: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
Traceback (most recent call last):
File "manage.py", line 18, in <module>
InstallAppengineHelperForDjango()
File "/home/username/Development/GAE/myapp/appengine_django/__init__.py", line 543, in InstallAppengineHelperForDjango
InstallDjangoModuleReplacements()
File "/home/username/Development/GAE/myapp/appengine_django/__init__.py", line 260, in InstallDjangoModuleReplacements
import django.db
File "/home/username/Development/GAE/myapp/django/db/__init__.py", line 57, in <module>
'TIME_ZONE': settings.TIME_ZONE,
File "/home/username/Development/GAE/myapp/appengine_django/db/base.py", line 117, in __init__
self._setup_stubs()
File "/home/username/Development/GAE/myapp/appengine_django/db/base.py", line 128, in _setup_stubs
from google.appengine.tools import dev_appserver_main
File "/home/username/bin/google_appengine/google/appengine/tools/dev_appserver_main.py", line 82, in <module>
from google.appengine.tools import appcfg
File "/home/username/bin/google_appengine/google/appengine/tools/appcfg.py", line 53, in <module>
from google.appengine.api import dosinfo
File "/home/username/bin/google_appengine/google/appengine/api/dosinfo.py", line 25, in <module>
import ipaddr
ImportError: No module named ipaddr
答案 0 :(得分:7)
http://code.google.com/p/ipaddr-py/ 安装。
有关问题的信息: http://code.google.com/p/google-app-engine-django/issues/detail?id=161#c3
来自谷歌:
> Hi, just apply this patch from: http://code.google.com/p/google-app-engine-
django/source/detail?r=102
-------
Log message
Adds new dependency, ipaddr, from SDK
Affected files expand all collapse all
Modify /trunk/appengine_django/__init__.py diff
...
129 129 SDK_PATH,
130 130 os.path.join(SDK_PATH, 'lib', 'antlr3'),
131 131 os.path.join(SDK_PATH, 'lib', 'django'),
132 + os.path.join(SDK_PATH, 'lib', 'ipaddr'),
132 133 os.path.join(SDK_PATH, 'lib', 'webob'),
133 134 os.path.join(SDK_PATH, 'lib', 'yaml', 'lib'),
134 135 ]
答案 1 :(得分:3)
也发生在app-engine-patch
解决方案是将$GOOGLE_APP_ENGINE/lib/ipaddr
添加到pythonpath中,因为您必须完成其他依赖项,如antlr3或yaml。
答案 2 :(得分:1)
我在本教程后面遇到同样的问题: http://code.google.com/appengine/articles/appengine_helper_for_django.html
我同意您需要将ipaddr添加到模块路径中。我是通过在名为ipaddr.pth的D:\ Python26 \ Lib \ site-packages目录中创建一个文本文件来实现的,它包含一行:
D:\Program Files\Google\google_appengine\lib\ipaddr
该模块的路径是什么。
另外需要注意的是,您不需要按照建议安装适用于Windows的Python,因为它不会自动获取appengine SDK(或者至少它似乎不适合我)。请注意,我在我的系统PATH变量上有D:\ Program Files \ Google \ google_appengine \,但我不确定这是否有帮助(这样我就可以从cli运行辅助脚本)。