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

387
Views
Django + Apache(httpd): Error loading MySQLdb module

I have tried to figure this out for a day now and cannot seem to make any headway.

I'm getting the following Apache error:

[wsgi:error] django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
[wsgi:error] Did you install mysqlclient?
[wsgi:error] [remote 10.10.10.90:35990] mod_wsgi (pid=14165): Target WSGI script '/var/www/vhosts/project_vision/web/web/wsgi.py' does not contain WSGI application 'application'.

pip3 freeze states mysql-connector and mysql-connector-python is installed. The mysql-connector-python versions matches mysql-community rpm's installed.

File structure is this (web is the name of the Django project within the larger Project_vision project):

/var/www/vhosts/project_vision
 |- venv/
 |- web/
    |- static
    |- templates
    |- vision_web
       |- models/
       |- migrations/
       |- ...
    |- web
       |- settings.py
       |- wsgi.py
 |- ...

/var/www/vhosts/project_vision/web/web/wsgi.py

import os
import signal
import sys
import time
import traceback

from django.core.wsgi import get_wsgi_application

sys.path.append('/var/www/vhosts/project_vision')
sys.path.append('/var/www/vhosts/project_vision/web')
sys.path.append('/var/www/vhosts/project_vision/venv')

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

try:
    application = get_wsgi_application()
except Exception:
    # Error loading applications
    if 'mod_wsgi' in sys.modules:
        traceback.print_exc()
        os.kill(os.getpid(), signal.SIGINT)
        time.sleep(2.5)

/etc/httpd/conf.d/vision.conf

<VirtualHost *:80>

    ServerName my_project_vision.com

    DocumentRoot /var/www/vhosts/project_vision/web

    Alias /static/ /var/www/vhosts/project_vision/web/static/

    <Directory /var/www/vhosts/project_vision/web/static>
        Require all granted
    </Directory>

    WSGIDaemonProcess my_project_vision.com \
        processes=2 threads=15 display-name=%{GROUP} \
        python-home=/var/www/vhosts/project_vision/venv \
        python-path=/var/www/vhosts/project_vision/web

    WSGIProcessGroup my_project_vision.com
    WSGIApplicationGroup %{GLOBAL}

    # Insert the full path to the wsgi.py-file here
    WSGIScriptAlias / /var/www/vhosts/project_vision/web/web/wsgi.py

    <Directory /var/www/vhosts/project_vision>
        AllowOverride all
        Require all granted
        Options FollowSymlinks
    </Directory>

</VirtualHost>

Where in the world am I going wrong? It must be something minor but important...

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!