0

I am trying to deploy a Django application using apache and i am getting the following error

[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'

My apache virtual host

 <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>

What should i do?..

tony
  • 1
  • 2

1 Answers1

0

Maybe its a python version mismatch , or you didnt add correctly the python path to the appache.conf . go check this post to know more about this error ->>> link

Ilyes Negadi
  • 69
  • 1
  • 8
  • python versions are same btw .The Python version of mod_wsgi is similar to one which i have installed – tony Oct 08 '21 at 10:19