Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

398
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda