Wsgi无法在venv中使用python版本编译应用程序,而是始终使用python 2.7进行编译。这是我的文件请帮助
我正在尝试使用Apache 2.4.6和mod-wsgi部署flask应用程序,centos 7.
目标WSGI脚本' /home/nmapi/project/dir/app.wsgi'无法加载,因为Python模块是错误
这是我的app.wsgi
activate_this = '/home/nmapi/venv/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
from werkzeug.wsgi import DispatcherMiddleware
import sys
import logging
print(sys.path)
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"home/nmapi/project/dir")
from run import *
我的虚拟主机配置是
WSGISocketPrefix / var / run / wsgi
#ServerName sample.server.com
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess score threads=5 python-home=/home/nmapi:home/nmapi/deps/venv/lib/python3.5
WSGIScriptAlias /test_wsgi
/home/nmapi/project/dir/datascience.wsgi
<Directory /home/nmapi/project/dir/>
#WSGIProcessGroup score
#AllowOverride All
Require all granted
#Allow from all
</Directory>
Alias /static /home/nmapi/project/dir/static
<Directory /home/nmapi/project/dir/static/>
WSGIProcessGroup score
#WSGIApplicationGroup %{GLOBAL}
#AllowOverride All
Require all granted
#Allow from all
</Directory>
ErrorLog logs/error.log
#ErrorLog /tmp/error.log
LogLevel debug
#CustomLog /tmp/access.log combined
CustomLog logs/access.log combined