关于在 Windows 7 开发环境中为 Google App Engine 设置 Django 的非常基本的新手问题。
我的 google_appengine 文件夹下有一个 Django 文件夹,其中包含所有 Django 分发文件夹(如 所有按钮按下的 djangoappengine 文档)位于 Django 文件夹下。
使用 App Engine 启动器并指定 django-testapp 文件夹的路径,我能够成功运行 ctst 脚本并得到“It Works!”信息。
所以问题是:到底如何确定要添加到 Windows PATH 环境变量的路径,以便当我尝试运行 Python 2.7 解释器以确认 Python(App Engine 启动器外部)可以看到时不会发生这种情况姜戈?
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
Python 解释器正在寻找什么文件?除此之外,是否有针对 Django、App Engine SDK 和 Python 本身的推荐目录设置来简化生活?
Very basic, newbie question on setting up Django for Google App Engine in a Windows 7 development environment.
I have a Django folder under the google_appengine folder, with all the Django distribution folders (as described in an All Buttons Pressed djangoappengine doc) under the Django folder.
Using the App Engine Launcher and specifying the path to the django-testapp folder, I was able to successfully run the ctst script and get the "It works!" message.
So here's the problem: Exactly how do I figure out what path to add to the Windows PATH env variable so that this doesn't happen when I try to run the Python 2.7 interpreter to confirm that Python (outside the App Engine Launcher) can see Django?
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
What file is the Python interpreter looking for? Beyond that, is there a recommended directory setup for Django, the App Engine SDK, and Python itself that will simplify life?
发布评论
评论(1)
我不认为 Python 通过 PATH 环境变量查找它的模块。不过,您可以将相关目录添加到 PYTHON_PATH 中,它应该会选择该目录。
另一个(可能更好)的解决方案是将适当的目录移动到您的 Python
site-packages
目录中,并确保其名称正确。I don't think Python looks for its modules via the
PATH
environment variable. You can add the relevant directory toPYTHON_PATH
though and it should pick that up.Another (probably better) solution would be to move the appropriate directory into your Python
site-packages
directory and making sure it is appropriately named.