django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

前端 未结 23 1032
夕颜
夕颜 2020-12-02 10:51

The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used.

 Traceback (most recent call l         


        
相关标签:
23条回答
  • 2020-12-02 11:35

    you have to install python-mysqldb - Python interface to MySQL

    Try
    sudo apt-get install python-mysqldb

    0 讨论(0)
  • 2020-12-02 11:35

    With the same error message as Will, it worked for me to install mysql first as the missing file will be added during the installation. So after

    brew install mysql
    
    pip install mysql-python
    

    ran without errors.

    0 讨论(0)
  • 2020-12-02 11:35

    Just to add to other answers, if you're using Django, it is advisable that you install mysql-python BEFORE installing Django.

    0 讨论(0)
  • 2020-12-02 11:35

    Maybe you can try the following mode of operation:
    sudo python manage.py runserver 0.0.0.0:8000

    0 讨论(0)
  • 2020-12-02 11:39

    Download and install Mysql-python from here for windows environment. http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python.

    0 讨论(0)
  • 2020-12-02 11:39

    I think it is the version error.

    try installing this in following order:

    1. sudo apt-get install python3-mysqldb

    2. pip3 install mysqlclient

    3. python3 manage.py makemigrations

    4. python3 manage.py migrate

    0 讨论(0)
提交回复
热议问题