Ubuntu 上的 Apache2.2+psycopg2.2.2+mod_wsgi 问题
因此,我遇到的问题与我在 Windows 上看到的人们抱怨的其他问题类似,但看起来他们的问题只是 Windows 独有的问题,已在新版本的 psycopg2 中得到修复。
基本上,我尝试访问我部署的应用程序只是为了在日志中获取以下内容。
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend.
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] Try using django.db.backends.XXX, where XXX is one of:
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] Error was: cannot import name utils
我似乎已经正确安装了所有内容,使用构建来检索依赖项等。我还能够成功地对我的数据库运行syncdb 并看到表被创建。
为什么在处理我已将其配置为使用 postgresql_psycopg2 的事实时出现问题?它甚至没有做任何特别的事情。我可以请求“myserver/”或“myserver/admin”或“myserver/whothehellcares”,但我不断收到相同的 500 错误。
就 Apache 而言,我使用了已配置的基本站点,并简单地添加了一行 WSGIScriptAlias 指向我的 wsgi 文件。我什至尝试使用 WSGIDaemonProcess 来定位特定用户(www-data)来运行进程,但这没有任何效果。
任何想法或帮助表示赞赏。
So I'm having a problem similar to others I've seen people complain about on Windows, but it appears theirs is a Windows only problem being fixed in a new version of psycopg2.
Basically, I am trying access my deployed application only to get the following in the logs.
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] TemplateSyntaxError: Caught ImproperlyConfigured while rendering: 'django.db.backends.postgresql_psycopg2' isn't an available database backend.
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] Try using django.db.backends.XXX, where XXX is one of:
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Fri Feb 25 16:29:26 2011] [error] [client 5.7.0.205] Error was: cannot import name utils
I seem to have everything properly install, using buildout to retrieve dependencies and such. I was also able to successfully run syncdb against my database and see the tables get created.
Why is it having problems dealing with the fact that I have configured it to use postgresql_psycopg2? It doesn't even make it to doing anything special. I can request "myserver/" or "myserver/admin" or "myserver/whothehellcares" and I constantly get the same 500 error.
As far as Apache goes, I used the basic site already configured and simply added the one line WSGIScriptAlias pointing to my wsgi file. I've even tried using WSGIDaemonProcess to target a specific user (www-data) for running the processes but that didn't have any effect.
Any thoughts or help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在非 Windows 系统上,可能是 32 位与 64 位问题。
创建 WSGI hello world 脚本,如下所述:
http://code.google.com/p /modwsgi/wiki/QuickConfigurationGuide
一旦 hello world 脚本正常工作,请在其开头添加您要使用的 psycopg2 模块的导入,并验证它是否可以导入。确保您使用的导入强制导入 pyscopy2 客户端模块的 C 扩展 .so。
如果失败,您可能会在 Apache 错误日志中看到更好的错误。 Django 有时可以掩盖真正的错误。
On non Windows systems, can be a 32 vs 64 bit problem.
Create a WSGI hello world script as described in:
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
Once you have the hello world script working, add at the start of it imports for the psycopg2 module you wish to use and validate that it can be imported. Ensure the import you use forces the import of the C extension .so for the pyscopy2 client module.
If it fails you may get a better error in the Apache error logs. Django can sometimes mask the real error.