回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>在我的amd64平台和ubuntu 11.04上有这样的cfg:</p>
<ol>
<li>从源代码构建python2.5到/usr/local/python2.5</li>
<li>virtualenv位于/home/se7en/.virtualenvs/e-py25</li>
</ol>
<p>alsp i重新编译mod_wsgi.so公司要自定义python:</p>
<pre><code>se7en@se7en-System-Product-Name:~$ ldd /usr/lib/apache2/modules/mod_wsgi.so
linux-vdso.so.1 => (0x00007fff5af6c000)
libpython2.5.so.1.0 => /usr/lib/libpython2.5.so.1.0 (0x00007f7bed14b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7becf2d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7becd28000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f7becb25000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7bec8a0000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7bec50b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7bed717000)
</code></pre>
<p>在django.wsgi公司在</p>
^{pr2}$
<p>apache站点配置:</p>
<pre><code><VirtualHost 192.168.1.3>
ServerAdmin admin@wsgi.debianworld.ru
ServerName wsgi.debianworld.ru
ErrorLog /home/se7en/workspace/lxchg/logs/error_log
CustomLog /home/se7en/workspace/lxchg/logs/access_log common
WSGIScriptAlias / /home/se7en/workspace/lxchg/django.wsgi
Alias "/media/" "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/contrib/admin/media/"
<Location "/media/">
SetHandler None
</Location>
Alias "/main_media/" "/home/se7en/workspace/lxchg/main_media/"
<Location "/main_media/">
SetHandler None
</Location>
</VirtualHost>
WSGIPythonHome /home/se7en/.virtualenvs/e-py25
#WSGIPythonExecutable /usr/local/python2.5/bin/python
</code></pre>
<p>我的错误日志中有一个错误:</p>
<pre><code>[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] mod_wsgi (pid=2955): Exception occurred processing WSGI script '/home/se7en/workspace/lxchg/django.wsgi'.
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] Traceback (most recent call last):
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 248, in __call__
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] response = self.get_response(request)
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/core/handlers/base.py", line 141, in get_response
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] return self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/core/handlers/base.py", line 176, in handle_uncaught_exception
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] if resolver.urlconf_module is None:
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/core/urlresolvers.py", line 239, in _get_urlconf_module
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] self._urlconf_module = import_module(self.urlconf_name)
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] __import__(name)
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "C:\\workspace\\sdl\\lxchg\\urls.py", line 3, in <module>
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/views/generic/create_update.py", line 1, in <module>
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] from django.forms.models import ModelFormMetaclass, ModelForm
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/forms/__init__.py", line 17, in <module>
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] from models import *
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/forms/models.py", line 6, in <module>
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] from django.db import connections
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/db/__init__.py", line 77, in <module>
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] connection = connections[DEFAULT_DB_ALIAS]
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/db/utils.py", line 92, in __getitem__
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] backend = load_backend(db['ENGINE'])
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] File "/home/se7en/.virtualenvs/e-py25/lib/python2.5/site-packages/django/db/utils.py", line 50, in load_backend
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] raise ImproperlyConfigured(error_msg)
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend.
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] Try using django.db.backends.XXX, where XXX is one of:
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
[Wed Jun 22 13:45:54 2011] [error] [client 192.168.1.3] Error was: /home/se7en/.virtualenvs/e-py25/lib/python2.5/lib-dynload/array.so: undefined symbol: PyUnicodeUCS2_FromUnicode
</code></pre>
<p>然后我开始via项目管理.py运行服务器它可以工作,但通过mod\wsgi不行。
请帮忙)</p>