Django manage.py syncdb throwing No module named MySQLdb

后端 未结 5 1003
花落未央
花落未央 2021-02-04 12:59

I am a newbie learning Python/Django...

Am using the following tutorial located here.

Created a mysite database in MySQL 5 running on Snow Leopard.

Edite

5条回答
  •  迷失自我
    2021-02-04 13:54

    It's worth pointing out (even at this late date) that the "ImproperlyConfigured" error below

    File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages /django/db/backends/mysql/base.py", line 13, in
    raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

    can be a red herring in cases where mysql isn't running - I was just googling this error myself, wondering why a misconfiguration had 'suddenly' appeared and while searching and prodding I ran some other manage.py command and got this similar, but much more helpful, error:

    File "~/.virtualenvs/mdid3/lib/python2.7/site-packages/MySQLdb/connections.py", line 187, in init

    super(Connection, self).init(*args, **kwargs2)

    _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' (61)")

    After checking mysqld, finding it not running and starting it -- my configuration error was miraculously fixed!

提交回复
热议问题