无法将Django设置导入Google App Engine

时间:2009-08-05 13:40:06

标签: python django google-app-engine

大家好,Google App Engine专家,

我之前使用过Django,但我是Google App Engine的新手 我第一次尝试使用它与Django的开发Web服务器。

我不知道这是否相关,但我之前有Django 1.1和 我的Windows XP上的Python 2.6,即使我已经卸载了Python 2.6注册表中仍有一个文件夹和条目。

我已按照Google的说明操作,但当我浏览GAE开发的网络服务器时,找不到我的设置 (详情如下)。

感激地收到任何提示。

此致

杰夫

C:\Documents and Settings\GeoffK\My Documents\ing\ingsite>echo %PATH% 
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS 
\system32\WindowsPowerShell\v1.0;;C:\Python25;C:\Python25\Lib\site- 
packages\django\bin;C:\Documents and Settings\GeoffK\My Documents\ing 
\ingsite;C:\Program Files\Google\google_appengine\ 
C:\Documents and Settings\GeoffK\My Documents\ing\ingsite>echo 
%PYTHONPATH% 
C:\Documents and Settings\GeoffK\My Documents\ing\ingsite 
C:\Documents and Settings\GeoffK\My Documents\ing\ingsite>C:\Documents 
and Settings\GeoffK\My Documents\ing\ingsite>dev_appserver.py -- 
debug_imports ingiliz\ 
INFO     2009-08-04 07:29:45,328 appengine_rpc.py:157] Server: 
appengine.google. 
com 
INFO     2009-08-04 07:29:45,358 appcfg.py:322] Checking for updates 
to the SDK. 
INFO     2009-08-04 07:29:45,578 appcfg.py:336] The SDK is up to date. 
WARNING  2009-08-04 07:29:45,578 datastore_file_stub.py:404] Could not 
read data 
store data from c:\docume~1\geoffk\locals~1\temp 
\dev_appserver.datastore 
WARNING  2009-08-04 07:29:45,578 datastore_file_stub.py:404] Could not 
read data 
store data from c:\docume~1\geoffk\locals~1\temp 
\dev_appserver.datastore.history 
WARNING  2009-08-04 07:29:45,608 dev_appserver.py:3296] Could not 
initialize ima 
ges API; you are likely missing the Python "PIL" module. ImportError: 
No module 
named _imaging 
INFO     2009-08-04 07:29:45,625 dev_appserver_main.py:465] Running 
application 
ingiliz on port 8080: http://localhost:8080 

..... 现在尝试浏览 如果需要更多详细信息,我可以发布 .....

    if not settings.DATABASE_ENGINE: 
  File "C:\Python25\lib\site-packages\django\conf\__init__.py", line 
28, in __ge 
tattr__ 
    self._import_settings() 
  File "C:\Python25\lib\site-packages\django\conf\__init__.py", line 
59, in _imp 
ort_settings 
    self._target = Settings(settings_module) 
  File "C:\Python25\lib\site-packages\django\conf\__init__.py", line 
94, in __in 
it__ 
    raise ImportError, "Could not import settings '%s' (Is it on 
sys.path? Does 
it have syntax errors?): %s" % (self.SETTINGS_MODULE, e) 
ImportError: Could not import settings 'settings' (Is it on sys.path? 
Does it ha 
ve syntax errors?): No module named settings 
INFO     2009-08-04 07:31:02,187 dev_appserver.py:2982] "GET / HTTP/ 
1.1" 500 - 

4 个答案:

答案 0 :(得分:2)

我遇到了类似的问题,我在我的根目录中放了一个空的settings.py文件,但它确实有效。

祝你好运

答案 1 :(得分:1)

用于本地测试在main.py

的开头添加这些
import os, sys
os.environ["DJANGO_SETTINGS_MODULE"] = "appid.settings"
sys.path.append("/app/folder")

答案 2 :(得分:0)

你是如何使用Django和谷歌应用程序引擎开发应用程序的?

如果你使用Django,settings.py应该已经在那里了。

Tyr App engine patch

它为使用Google应用和Django开发应用程序提供了一个很好的起点。

答案 3 :(得分:0)

在将appengine_config.py添加到我的项目后,我开始遇到这些问题。在文件中我有不正确的设置路径(只是设置,即使我应该有myproj.settings)

os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'

“有趣”的转折是当一切顺利时,这并没有造成任何麻烦。只有在遇到一些错误后,我才开始抱怨无法导入设置。