2012-07-04 67 views
0

pythonbrew是没有得到通过mod_wsgi的文件拾起,配置如下:pythonbrew与mod_wsgi的

import os 
import sys 
import site 

site.addsitedir('/home/bharal/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages') 
sys.path.append ('/home/bharal/public_html/dumpstown') 

os.environ['DJANGO_SETTINGS_MODULE'] = 'dumpstown.settings' 

import django.core.handlers.wsgi 
application = django.core.handlers.wsgi.WSGIHandler() 

和python的pythonbrew版本我想使用这里位于:

/家/bharal/.pythonbrew/pythons/Python-2.7.2/lib/python2.7/site-packages

和我pythonbrew安装是在这里:

/home/bharal/.pythonbrew/

我如何告诉mod_wsgi的使用这个版本(2.7.2),而不是与Ubuntu的(2.6)出厂默认的Python版本?

当我跑我的服务器,我得到的错误,像这样:

[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] mod_wsgi (pid=18694): Exception occurred processing WSGI script '/home/bharal/public_html/dumpstown/dumpstown/apache/dumpstown.wsgi'. 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] Traceback (most recent call last): 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/wsgi.py", line 250, in __call__ 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]  self.load_middleware() 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 39, in load_middleware 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]  for middleware_path in settings.MIDDLEWARE_CLASSES: 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] File "/usr/local/lib/python2.6/dist-packages/django/utils/functional.py", line 276, in __getattr__ 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]  self._setup() 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 42, in _setup 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]  self._wrapped = Settings(settings_module) 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] File "/usr/local/lib/python2.6/dist-packages/django/conf/__init__.py", line 89, in __init__ 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1]  raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e)) 
[Wed Jul 04 02:17:27 2012] [error] [client 127.0.0.1] ImportError: Could not import settings 'dumpstown.settings' (Is it on sys.path?): No module named gravatar.templatetags 

,你可以从日志中看到,该服务器是仍然看着蟒蛇2.6!为什么?我已经启动pythonbrew所以当输入python我可以看到版本是2.7.2,并且我需要的所有设置和软件包都是可导入的!

UPDATE如下答复中指出,该mod_wsgi的不护理的Python我告诉它使用 - 事实上,我不能告诉它使用任何特别的蟒蛇。唯一的方法是下载一个未编译的wsgi文件,用我想要的特定python版本进行编译,并使用已编译的wsgi。

看到我的其他问题Error: Command failed with rc=65536 python and mod_wsgi的一些步骤和链接到tutes,如果你喜欢。最后我没有编译对2.7(我的2.6是好的,它太难以让pythonbrew编译工作)

回答

1

该特定的错误与所用的Python版本无关。用途:

sys.path.append( '/家庭/石羊/的public_html') sys.path.append( '/家庭/石羊/的public_html/dumpstown')

要获得mod_wsgi的使用特定的版本,根据该版本的源代码进行编译,或者找到针对正确版本编译的mod_wsgi的二进制包。