我正在使用Google App Engine进行Django开发。在生产环境中,我计划使用Google Cloud SQL,但在本地开发中我想使用简单的SQLITE。谷歌教程(https://developers.google.com/appengine/docs/python/cloud-sql/django)建议我使用以下命令运行开发服务器:
然而,当我按照Google建议运行开发服务器时,我遇到了两个奇怪的错误(为了清晰起见,我删除了其余的堆栈跟踪)。
最奇怪的是,当我只使用manage.py runserver时,网站可以正常工作。而且当我直接在sqlite3的交互式python提示符中进行测试时,它也可以正常工作:
dev_appserver.py mysite
使用Django默认设置的代替方案
manage.py runserver
然而,当我按照Google建议运行开发服务器时,我遇到了两个奇怪的错误(为了清晰起见,我删除了其余的堆栈跟踪)。
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django1.5/django/db/backends/sqlite3/base.py", line 34, in <module>
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named _sqlite3
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/django-1.5/django/core/handlers/base.py", line 53, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e)) ImproperlyConfigured: Error importing middleware django.contrib.auth.middleware: "cannot import name utils"
最奇怪的是,当我只使用manage.py runserver时,网站可以正常工作。而且当我直接在sqlite3的交互式python提示符中进行测试时,它也可以正常工作:
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>>
有人能在这里帮助我吗?我不确定接下来该怎么做。先谢谢了!