Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
338 views
in Technique[技术] by (71.8m points)

python - mod_wsgi isn't honoring WSGIPythonHome

I'm trying to get WSGI to run with a virtualenv setup. I have the virtualenv all working right:

(virtualenv)dev:/var/www/app$ which python
/var/www/virtualenv/bin/python
(virtualenv)dev:/var/www/app$ python
Python 2.6.1 (r261:67515, Dec  5 2008, 22:09:34)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import importlib
>>>

And in my httpd.conf, I have the following, as described here:

WSGIPythonHome /var/www/virtualenv
WSGIPythonPath /var/www/virtualenv/lib/python2.6/site-packages

But when I try to load the app via apache, i get the following error:

[Wed Dec 28 12:28:15 2011] [error] [client 127.0.0.1] mod_wsgi (pid=15026): Exception occurred processing WSGI script '/var/www/app/wsgi.py'.
[Wed Dec 28 12:28:15 2011] [error] [client 127.0.0.1] Traceback (most recent call last):
[Wed Dec 28 12:28:15 2011] [error] [client 127.0.0.1]   File "/var/www/app/wsgi.py", line 29, in <module>
[Wed Dec 28 12:28:15 2011] [error] [client 127.0.0.1]     import importlib
[Wed Dec 28 12:28:15 2011] [error] [client 127.0.0.1] ImportError: No module named importlib

What am I missing? How do even debug this kind of problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Your mod_wsgi is likely compiled against a different Python version than you are trying to force it to use. For example, you can not use mod_wsgi compiled against Python 2.4 with a virtual environment constructed using Python 2.6.

Validate what version of Python mod_wsgi was built for in the first place.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...