Problem running syncdb in django

て烟熏妆下的殇ゞ 提交于 2019-12-25 02:22:44

问题


I am trying to go through the django docs tutorial and having a problem syncing mysql. On the command python manage.py syncdb I get the following error (note I'm running in windows 7):

...
File "C:\python27\lib\site-packages\django\db\backends\mysql\base.py", line 14, in <module>
raise Improperlyconfigured("Error loading Mysqldb module: %s" % e) 
django.core.excepions.Improperlyconfigured: Error loading Mysqldb module: No module named mySQLdb

I have initialized the db in setting.py as:

'ENGINE': 'django.db.backends.mysql', 
'NAME': 'mysite',    #the name I gave in Mysql with 'CREATE DATABASE mysite;'                 
'USER': 'root',                      
'PASSWORD': 'mypassword',   # as set in MysqlInstanceConfig
'HOST': '',                     
'PORT': '',  

So how do I get syncdb to run correctly? What does the missing module error mean and how do I correct it?


回答1:


You need to install the python mysql library. Here is a django-related guide to do this on windows




回答2:


You have to install the mySQLdb module.




回答3:


You most probably haven't installed the Python module that handles the mysql connections. You can install it through the Cheeseshop with pip or easy_install and it's called MySQL-python.



来源:https://stackoverflow.com/questions/6076098/problem-running-syncdb-in-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!