我正在尝试在 Ubuntu 16.04.6 服务器上部署带有 Apache2 和 mod_wsgi 的 Django 应用程序,但我正在努力让 mod_wsgi 使用正确的 python 版本。
我从源代码安装了 mod_wsgi,并将其配置为针对系统 python3 编译,特别是 python3.7.8
我的 Django 应用程序的虚拟环境也在运行 python3.7.8。
我的 VirtualHost 配置文件如下所示:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName kumberas.com
ServerAdmin webmaster@localhost.com
WSGIScriptAlias / /home/dan/app/kumberas/kumberas/main/wsgi.py
Alias /static/ /home/dan/app/kumberas/kumberas/static/
<Directory /home/dan/app/kumberas/kumberas/static>
Require all granted
</Directory>
<Directory /home/dan/app/kumberas/venv>
Require all granted
</Directory>
<Directory /home/dan/app/kumberas/kumberas/main>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Location />
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require user kr
AuthBasicProvider file
</Location>
WSGIDaemonProcess kumberas …Run Code Online (Sandbox Code Playgroud)