我正在尝试使用带有虚拟环境的 wsgi 配置 apache。但是 apache 使用另一个版本(1.3.1)为我的 django 服务。另一个版本是我在标准 python 设置中的默认安装。
小路
/opt/django/webtools_django15/
|-- __init__.py
|-- myapp
| |-- __init__.py
| |-- __init__.pyc
| |-- myapp.wsgi
| |-- myapp_settings.py
| |-- myapp_settings.pyc
| |-- myapp_urls.py
| |-- forms.py
| |-- forms.pyc
| |-- models.py
| |-- tests.py
| |-- views.py
| |-- views.py-bak
| `-- views.pyc
|-- manage.py
|-- modules
| `-- dnslookup.py
|-- static
| !! omitted !!
|-- templates
| `-- myapp
| |-- myapp-about.html
| |-- myapp-base.html
| |-- myapp-cachecheck-result.html
| |-- myapp-glossary.html
| |-- myapp-home.html
| |-- myapp-input-cachecheck.html
| |-- myapp-input-cachecheck.html-bak
| |-- myapp-input-lookup.html
| |-- myapp-input-lookup.html-bak
| |-- myapp-input-report.html
| |-- myapp-input-report.html-bak
| |-- myapp-lookup-result.html
| |-- myapp-partners.html
| |-- myapp-ratelimited.html
| `-- myapp-report-result.html
`-- webtools_django15
|-- __init__.py
|-- __init__.pyc
|-- settings.py
|-- settings.py-bak
|-- settings.pyc
`-- urls.py
WSGI 文件
(django15)[root@bob-x django]# cat /opt/django/webtools_django15/myapp/myapp.wsgi
import os
import sys
import site
site.addsitedir("/opt/django/virtenv/django15/lib/python2.7/site-packages/")
from django.core.handlers.wsgi import WSGIHandler
sys.path.append('/opt/django/webtools_django15/')
sys.path.append('/opt/django/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'myapp.myapp_settings'
application = WSGIHandler()
阿帕奇
<VirtualHost *:80 >
DocumentRoot /opt/django/webtools_django15/
ServerName myapp.co.uk
ServerAlias www.myapp.co.uk direct.myapp.co.uk
WSGIApplicationGroup myapp
WSGIScriptAlias / /opt/django/webtools_django15/myapp/myapp.wsgi
WSGIDaemonProcess myapp processes=5 python-path=/opt/django/webtools_django15:/opt/django/virtenv/django15/lib/python2.7/site-packages/ threads=1
Alias /static/ /opt/django/webtools_django15/static/
ErrorLog logs/myapp-error.log
CustomLog logs/myapp-access.log common
</VirtualHost>
关于正在发生的事情的任何想法......?