Django 500 Internal Server Error - ImproperlyConfigured: Error loading MySQLdb module:

后端 未结 2 373
悲哀的现实
悲哀的现实 2021-01-24 11:38

Im new to using MySQL in general and as a database for Django. I have followed a number of different tutorials and the documentation but keep getting a 500 Internal Serv

相关标签:
2条回答
  • 2021-01-24 11:58

    In the interest of helping others who may come to this post with the same error:

    I was receiving the same error, but my MySQL-python version was the same as the expected: 1.2.5. The problem was that I had the MySQLdb folder symlinked into my project's root folder. By moving the symlinked folder into the folder that holds my Django settings I was able to fix the issue.

    0 讨论(0)
  • 2021-01-24 12:16

    This line:

    ImproperlyConfigured: Error loading MySQLdb module: this is MySQLdb version (1, 2, 5, 'final', 1), but _mysql is version (1, 2, 3, 'final', 0) 
    

    indicates you might have a version mismatch between MysqlDB and MySQL. Sounds like looking in to it and reinstalling your dependent libraries resolved the issue.

    To describe the issue in further detail:

    In this case apt-get was installing MySQL-python==1.2.3. The latest version is MySQL-python==1.2.5. However apt-get was not finding it, so completely removing MySQL-python==1.2.3 using:

    sudo apt-get remove --purge python-mysqldb
    

    and then reinstall via pip

    sudo pip install mysql-python
    

    (Note the package names are slightly different)

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