为什么我在尝试使用 mod_wsgi 部署 Django 时收到 TemplateSyntaxError?
我正在尝试在 Windows 下使用 Apache 设置 Django。我已经激活了 mod_wsgi 模块,但是当我访问 localhost 时,出现内部服务器错误,并且 Apache 错误日志中出现以下内容:
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend.
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] Try using django.db.backends.XXX, where XXX is one of:
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] Error was: cannot import name utils
我的数据库后端不被接受。如果我运行开发服务器,它就可以工作,如果我将数据库设置保留为空字符串,它也可以工作(我只有一个非常简单的测试页,只有一些文本)。
wsgi 文件如下:
import os, sys
sys.path.append('/usr/local/django')
sys.path.append('/usr/local/django/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
I am trying to setup Django with Apache under Windows. I've activated the mod_wsgi module but when I access the localhost I get an Internal Server Error and the following appears in the Apache error log:
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend.
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] Try using django.db.backends.XXX, where XXX is one of:
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3
[Fri Nov 26 18:20:31 2010] [error] [client 127.0.0.1] Error was: cannot import name utils
My database backend is not accepted. It works if I run the development server, and it also works if I leave the database settings as empty strings (I only have a very simple test page, just some text).
The wsgi file is the following:
import os, sys
sys.path.append('/usr/local/django')
sys.path.append('/usr/local/django/mysite')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的网络服务器没有可用的文件描述符。重新配置 mod_wsgi 为守护进程模式。
Your web server is out of available file descriptors. Reconfigure mod_wsgi for daemon mode.