WSGI ERROR :Целевой скрипт WSGI не может быть загружен как модуль Python

Я пытаюсь развернуть приложение Django с помощью apache и получаю следующую ошибку

[Fri Oct 08 07:55:44.393237 2021] [wsgi:error] [pid 12424:tid 140450959271680]  mod_wsgi (pid=12424): Target WSGI script '/home/preinstall/hx_preinstaller/hx_preinstaller/wsgi.py' cannot be loaded as Python module.
[Fri Oct 08 07:55:44.393281 2021] [wsgi:error] [pid 12424:tid 140450959271680]  mod_wsgi (pid=12424): Exception occurred processing WSGI script '/home/preinstall/hx_preinstaller/hx_preinstaller/wsgi.py'.
[Fri Oct 08 07:55:44.393408 2021] [wsgi:error] [pid 12424:tid 140450959271680]  Traceback (most recent call last):
[Fri Oct 08 07:55:44.393430 2021] [wsgi:error] [pid 12424:tid 140450959271680]  File "/home/preinstall/hx_preinstaller/hx_preinstaller/wsgi.py", line 12, in <module>
[Fri Oct 08 07:55:44.393435 2021] [wsgi:error] [pid 12424:tid 140450959271680]  from django.core.wsgi import get_wsgi_application
[Fri Oct 08 07:55:44.393446 2021] [wsgi:error] [pid 12424:tid 140450959271680]  ModuleNotFoundError: No module named 'django'

Мой виртуальный хост apache

 <VirtualHost *:80>
   DocumentRoot /home/preinstall/hx_preinstaller
    ErrorLog ${APACHE_LOG_DIR}/preinstall_error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory /home/preinstall/hx_preinstaller/hx_preinstaller>
        <Files wsgi.py>
            Require all granted
        </Files>
         </Directory>
                 <Directory /home/preinstall/hx_preinstaller>
                 Require all granted
                 </Directory>
                 WSGIDaemonProcess preinstall python-path=/home/preinstall/hx_preinstaller:/home/preinstall/.local/lib/python3.6/site-packages
                WSGIProcessGroup preinstall
                WSGIPassAuthorization On
                WSGIScriptAlias / /home/preinstall/hx_preinstaller/hx_preinstaller/wsgi.py
</VirtualHost>

Что мне делать?..

Возможно, это несоответствие версии python, или вы не добавили правильный путь к python в appache.conf. проверьте этот пост, чтобы узнать больше об этой ошибке ->>> link

Вернуться на верх