【发布时间】:2014-02-24 15:28:01
【问题描述】:
我已经开始学习 django 和 python,而且我是使用 ubuntu 的新手。对于我的第一个程序,我需要 mysql,所以我已经安装了它,当我使用 mysql 命令时,我得到了这个结果。
user@ubuntu:~$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 40
Server version: 5.5.34-0ubuntu0.12.10.1 (Ubuntu)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
但是当我根据 django 站点指令运行这个命令时
python manage.py syncdb
我有这个错误
File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
此外,我在 settings.py 文件中做了一些修改,如下所示:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'firstprojectdb',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
为什么会这样?我该如何解决?
【问题讨论】:
标签: mysql django ubuntu django-models mysql-python