【问题标题】:mysql database not working on djangomysql数据库无法在django上运行
【发布时间】:2012-12-19 07:04:30
【问题描述】:
DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
    'NAME': 'djangodb',             
    'USER': 'root',                 
    'PASSWORD': '',                 
    'HOST': '',                    
    'PORT': '',                      
} 
  }

我现在创建了一个数据库 djangodb 尝试创建表 用这个命令

./manage.py syncdb

我希望得到

Creating table auth_message
Creating table auth_group
Creating table auth_user
Creating table auth_permission
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table blog_blogpost

但我收到此错误:

django.core.exceptions.ImproperlyConfigured: Error loading  MySqldb module: no module named MySqldb

我什至尝试建立一个主机 127.0.0.1 。谁能弄清楚发生了什么。

【问题讨论】:

    标签: python mysql django python-module


    【解决方案1】:

    你安装了 MySQL-python 了吗?

    pip install mysql-python
    

    【讨论】:

      【解决方案2】:

      来自the docs

      如果您使用 MySQL,则需要 MySQL-python 软件包,版本 1.2.1p2 或更高版本。您还需要阅读 MySQL 后端的数据库特定说明。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-03-06
        • 2015-07-22
        • 2013-09-10
        • 1970-01-01
        • 1970-01-01
        • 2016-04-01
        相关资源
        最近更新 更多