小编djc*_*zzi的帖子

Django/mod_wsgi/Apache - mod_wsgi 没有使用它编译的 Python 版本 - “ModuleNotFoundError: No module named 'math'”

我正在尝试在 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)

python apache django mod-wsgi python-3.x

7
推荐指数
1
解决办法
609
查看次数

标签 统计

apache ×1

django ×1

mod-wsgi ×1

python ×1

python-3.x ×1