psycopg2的ImproperlyConfigured

psycopg2的ImproperlyConfigured

本文介绍了Django的,mod_wsgi的,psycopg2的ImproperlyConfigured:错误加载模块psycopg2的:无模块名为_psycopg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django 1.5,Python 2.7版网站的CentOS 6.4的服务器上的Apache下运行与mod_wsgi的。

I have a Django 1.5, Python 2.7 site running under Apache with mod_wsgi on a CentOS 6.4 server.

我已经重建使用Django 1.6和Python 3.3这个网站。它部署到同一台服务器,改变在httpd.conf我得到这个问题的错误的路径。这种新的安装使用作品的runserver ./manage.py预期。

I have rebuilt this site using Django 1.6 and Python 3.3. Deploying it to the same server and changing the paths in httpd.conf I get the subject error. This new install works as expected using ./manage.py runserver.

下面是两个WSGI定义从httpd.conf中:

Here are the two WSGI definitions from httpd.conf:

WSGIScriptAlias / /home/ccdgen/CCDGEN2/apache/wsgi.py
WSGIPythonPath         /home/ccdgen/CCDGEN2/ccdgen/ccdgen:/home/ccdgen/CCDGEN2/ccdgen:/home/ccdgen/CCDGEN2/lib/python3.3/site-packages
<Directory /home/ccdgen/CCDGEN2/ccdgen>
   <Files wsgi.py>
     Order allow,deny
     Allow from all
   </Files>
</Directory>

#WSGIScriptAlias /ccdgen /home/ccdgen/CCDGEN/apache/wsgi.py
#WSGIPythonPath /home/ccdgen/CCDGEN/mlhim/ccdgen:/home/ccdgen/CCDGEN/mlhim:/home/ccdgen/CCDGEN/lib/python2.7/site-packages
#<Directory /home/ccdgen/CCDGEN/mlhim>
#   <Files wsgi.py>
#     Order allow,deny
#     Allow from all
#   </Files>
#</Directory>

该wsgi.py文件是两个安装在相同的:

The wsgi.py file is the same on both installations:

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mlhim.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

任何想法?显而易见的疏漏?谢谢

Any ideas? Obvious oversights? Thanks

推荐答案

但问题是,mod_wsgi的编译为Python 2.7,它需要重新编译为Python 3.3。我没有找到可用的新的mod_wsgi任何地方作为一个包,所以我重新编译它。

The problem was that mod_wsgi was compiled for Python 2.7 and it needed to be recompiled for Python 3.3. I did not find a new mod_wsgi available anywhere as a package so I recompiled it.

因为Python 3是一个备用安装在CentOS 6.4 .configure有产生良好的Makefile困难的时候,甚至传递--with-python的选项。我需要从python3.3-配置--cflags获取信息,并与--ldflags选项后编辑Makefile文件了一下。

Since Python 3 is an alternate install on CentOS 6.4 .configure had a difficult time producing a good Makefile, even passing the --with-python option. I needed to edit Makefile a bit after getting the information from python3.3-config --cflags and also with --ldflags options.

HTH人的未来。

这篇关于Django的,mod_wsgi的,psycopg2的ImproperlyConfigured:错误加载模块psycopg2的:无模块名为_psycopg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 18:01