1

我正在尝试使用 apache 和 mod_wsgi 设置我的 django 应用程序(虚拟环境)。该应用程序在 RHEL8 机器上运行,唯一运行的 python 是 python 3。

RHEL 版本 == Red Hat Enterprise Linux 版本 8.2 (Ootpa)

python 版本 == Python 3.6.8。

apache 版本 == Apache/2.4.37(红帽企业 Linux)。

mod_wsgi 版本 == 4.7.1。

django 版本 == 3.1。

我的 Python 虚拟环境主页是: python-home using sys.prefix

我已经使用 CMMI 方法创建了 mod_wsgi.so。以下是图书馆详情

ldd mod_wsgi.so详细信息

下面是我的 apache 虚拟主机 conf 文件。我也尝试过添加 python-path(如下所示),虽然没有写在下面的 conf 文件详细信息中。

WSGIDaemonProcess sohail python-home=/home/ilearn/webapps/sohail python-path=/home/ilearn/webapps/sohail/src

webapptest.conf:

<VirtualHost *:80>

WSGIScriptAlias /webapptest /home/ilearn/webapps/sohail/src/webapptraining/wsgi.py
WSGIDaemonProcess sohail python-home=/home/ilearn/webapps/sohail

WSGIProcessGroup sohail
WSGIApplicationGroup %{GLOBAL}


<Directory /home/ilearn/webapps/sohail/src/webapptraining>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

</VirtualHost>

一旦我启动我的 apache 服务器,我就会ModuleNotFoundError: No module named 'encodings'在错误日志中看到错误。

[core:notice] [pid 4576:tid 139861315184960] AH00052: child pid 4893 exit signal Aborted (6)
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'

感谢任何帮助或建议来解决问题。

谢谢。

4

0 回答 0