我是 django 的新手。我正在使用 ubuntu 13.04
虽然我通过 phpmyadmin 创建了数据库,并且还在 settings.py 中输入了凭据,但是当我在控制台中输入时
python manage.py syncdb
我收到了这个错误
回溯(最近一次通话最后):
文件“manage.py”,第 10 行,在
execute_from_command_line(sys.argv)
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/init .py ”,第 453 行,在 execute_from_command_line
utility.execute()
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/init .py ”,第 392 行,在执行
self.fetch_command(subcommand).run_from_argv(self.argv)
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/init .py”,第 272 行,在fetch_command
klass = load_command_class(app_name, subcommand)
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/init .py”,第 77 行,在load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
文件“/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py”,第 35 行,在 import_module
__import__(name)
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py”,第 8 行,在
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
文件“/usr/local/lib/python2.7/dist-packages/django/core/management/sql.py”,第 9 行,在
from django.db import models
文件“/usr/local/lib/python2.7/dist-packages/django/db/init .py ”,第 40 行,在
backend = load_backend(connection.settings_dict['ENGINE'])
文件“/usr/local/lib/python2.7/dist-packages/django/db/init .py ”,第 34 行,在getattr
return getattr(connections[DEFAULT_DB_ALIAS], item)
文件“/usr/local/lib/python2.7/dist-packages/django/db/utils.py”,第 93 行,在getitem
backend = load_backend(db['ENGINE'])
load_backend 中的文件“/usr/local/lib/python2.7/dist-packages/django/db/utils.py”,第 27 行
return import_module('.base', backend_name)
文件“/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py”,第 35 行,在 import_module
__import__(name)
文件“/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py”,第 17 行,在
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured:加载 MySQLdb 模块时出错:没有名为 MySQLdb 的模块
我曾尝试在 settings.py 中为数据库名称提供扩展名,但它没有用。请建议该怎么做。谢谢 !