我正在尝试在 Visual Studio 2012 中设置一个将发布到 Google App Engine 的 django 应用程序。我使用 pytools 在 Visual Studio 中设置了一个简单的 hello World 应用程序,我可以在开发环境中成功运行。
我添加了一个 app.yaml 文件,下载了 AppEngine SDK 并将现有应用程序导入到 Google App Engine Launcher 应用程序中。如果我使用 App Engine Launcher 在本地启动应用程序,它会启动,但页面只是一个错误。我从日志中得到以下信息:
2013-05-23 07:47:03 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8080', '--admin_port=8000', 'Z:\\gridtreecontrol\\GridTreeView\\GridTreeView']"
INFO 2013-05-23 07:47:09,496 devappserver2.py:522] Skipping SDK update check.
WARNING 2013-05-23 07:47:09,523 api_server.py:329] Could not initialize images API; you are likely missing the Python "PIL" module.
INFO 2013-05-23 07:47:09,543 api_server.py:153] Starting API server at: http://localhost:61149
INFO 2013-05-23 07:47:09,552 dispatcher.py:164] Starting server "default" running at: http://localhost:8080
INFO 2013-05-23 07:47:09,558 admin_server.py:117] Starting admin server at: http://localhost:8000
ERROR 2013-05-23 12:47:32,108 wsgi.py:235]
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 223, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "C:\Program Files\Google\google_appengine\lib\django-1.4\django\core\handlers\wsgi.py", line 219, in __call__
self.load_middleware()
File "C:\Program Files\Google\google_appengine\lib\django-1.4\django\core\handlers\base.py", line 39, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "C:\Program Files\Google\google_appengine\lib\django-1.4\django\utils\functional.py", line 184, in inner
self._setup()
File "C:\Program Files\Google\google_appengine\lib\django-1.4\django\conf\__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "C:\Program Files\Google\google_appengine\lib\django-1.4\django\conf\__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'settings' (Is it on sys.path?): No module named settings
INFO 2013-05-23 07:47:32,128 server.py:585] default: "GET / HTTP/1.1" 500 -
似乎它希望我对 sys.path 进行一些调整,但我觉得如果我这样做了,它不会将这些更改传播到 Google App Engine 上的生产服务器。我曾尝试将应用程序发布到服务器,但在那里得到同样的错误。
在 Visual Studio 中运行应用程序时,我没有收到此错误。