Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

372
Views
how to solve 500 internal server error mod_wsgi apache "importerror: No Module named 'django'

I have been trying to solve this error but I am not been able to solve, totally frustrated because I have tried every single answer on these related question , any help would be appreciated.

My configuration of VPS server

Ubuntu 18.04
django 2.2.5
apache 2.4.49
python 3.6(virtualenv)
libapache2-mod-wsgi-py3 

My folder structure is:

/var/www/dataforze/prediction_project/venv (virtualenv folder)
    bin
    include
    lib

/var/www/dataforze/prediction_project
    |- manage.py
    static
    venv
    prediction_project
        |__init__.py
        |settings.py
        |urls.py
        |wsgi.py

000-default.conf file code

<VirtualHost *:80>

    <Directory /var/www/dataforze/prediction_project/prediction_project>
            Require all granted
    </Directory>


    <Directory /var/www/dataforze/prediction_project/prediction_project>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    WSGIDaemonProcess prediction_project python-path=/var/www/dataforze/prediction_project python-home=/var/www/dataforze/prediction_project/venv
    WSGIProcessGroup prediction_project
    WSGIScriptAlias / /var/www/dataforze/prediction_project/prediction_project/wsgi.py

   ErrorLog ${APACHE_LOG_DIR}/mysite_error.log
   LogLevel warn

</VirtualHost>

my wsgi.py file code import os

from django.core.wsgi import get_wsgi_application

sys.path.append('/var/www/dataforze/prediction_project/prediction_project')

# add the virtualenv site-packages path to the sys.path
sys.path.append('/var/www/dataforze/prediction_project/venv/lib/site-packages')

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'prediction_project.settings')

application = get_wsgi_application()

My server logs

[Wed Mar 18 17:29:01.003624 2020] [wsgi:error] [pid 82169:tid 140431942575872]  mod_wsgi (pid=82169): Target WSGI script '/var/www/dataforze/prediction_project/prediction_project/wsgi.py' cannot be loaded as Python module.
[Wed Mar 18 17:29:01.003722 2020] [wsgi:error] [pid 82169:tid 140431942575872]  mod_wsgi (pid=82169): Exception occurred processing WSGI script '/var/www/dataforze/prediction_project/prediction_project/wsgi.py'.
[Wed Mar 18 17:29:01.003823 2020] [wsgi:error] [pid 82169:tid 140431942575872]  Traceback (most recent call last):
[Wed Mar 18 17:29:01.003844 2020] [wsgi:error] [pid 82169:tid 140431942575872]  File "/var/www/dataforze/prediction_project/prediction_project/wsgi.py", line 12, in <module>
[Wed Mar 18 17:29:01.003849 2020] [wsgi:error] [pid 82169:tid 140431942575872]    from django.core.wsgi import get_wsgi_application
[Wed Mar 18 17:29:01.003864 2020] [wsgi:error] [pid 82169:tid 140431942575872]  ModuleNotFoundError: No module named 'django'
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!