【发布时间】:2015-10-15 02:56:03
【问题描述】:
我在一些应该相对简单的事情上遇到了麻烦——在 Windows 机器上启动一个 django-nonrel 项目。我已经从http://djangoappengine.readthedocs.org/en/latest/installation.html 下载并解压缩了所需的文件,将所需的模块添加到我的项目根文件夹 C:\djangoapp 中,这样文件夹层次结构就是(注意每个模块都包含正确的文件,为了简洁)
djangoapp/
autoload/
dbindexer/
django/
djangoappengine/
djangotoolbox/
现在当我 cd 进入 C:\djangoapp 时,我需要知道要运行的命令。给定的命令:
PYTHONPATH=. python django/bin/django-admin.py startproject \
--name=app.yaml --template=djangoappengine/conf/project_template myapp .
适用于 *NIX 操作系统,显然不能在 Windows 上运行。简单的做,
python django/bin/django-admin.py startproject \
--name=app.yaml --template=djangoappengine/conf/project_template myapp
返回此错误:
Traceback (most recent call last):
File "django/bin/django-admin.py", line 2, in <module>
from django.core import management
ImportError: No module named django.core
显然 PYTHONPATH 存在问题,因为给定的 Unix 命令以 PYTHONPATH= 开头。我将如何在 Windows 机器上执行等效项以启动并运行 django-nonrel?提前致谢!
附:只是为了学习,有人可以分解给定的 unix 命令,就句点和反斜杠的作用而言。再次感谢!
****** 响应更新 *******
非常感谢,尼克!您回答了我问题的每个部分,并且解决方案非常有效。不幸的是下一步,
python manage.py runserver
遇到了一个奇怪的错误:
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\ext\testbed\__init__.py", line 585, in init_images_stub
raise StubNotSupportedError(msg)
google.appengine.ext.testbed.StubNotSupportedError: Could not initialize images API; you are likely missing the Python "PIL" module.
显然不是正确的解决方案,但我只是去文件位置并注释掉处理图像存根的相关块,服务器启动正常。如果有人知道实际的解决方案,请在我进一步研究时告诉我!
再次感谢
【问题讨论】:
-
就 PIL 而言,如果您搜索该错误,您可能会找到 some answers。我不确定该线程中的任何内容是否会有所帮助,但我们不尝试就无法知道。最后,您可以尝试在生产环境中混合使用 app.yaml
libraries节,但在开发环境的 python 路径中提供您自己的 PIL 版本。
标签: python django windows google-app-engine django-nonrel