ImportError:在Ubuntu 11.04服务器上的django项目中,没有名为mysql.base的模块

|| 我正在按照Django书中的步骤进行操作,然后转到作者解释如何设置Django项目以使用数据库的部分。我选择了mysql。 我在
settings.py
中的设置是:
DATABASES = {
    \'default\': {
        \'ENGINE\': \'mysql\',               # Add \'postgresql_psycopg2\', \'mysql\', \'sqlite3\' or \'oracle\'.
        \'NAME\': \'mydatabase\',                  # Or path to database file if using sqlite3.
        \'USER\': \'myname\',                # Not used with sqlite3.
        \'PASSWORD\': \'mypassword\',        # Not used with sqlite3.
        \'HOST\': \'\',                      # Set to empty string for localhost. Not used with sqlite3.
        \'PORT\': \'\',                      # Set to empty string for default. Not used with sqlite3.
    }
}
尝试启动服务器时,将显示以下消息:
Validating models...

Traceback (most recent call last):
  File \"/home/me/workspace/mysite/src/mysite/manage.py\", line 14, in <module>
    execute_manager(settings)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 442, in execute_manager
    utility.execute()
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py\", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py\", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py\", line 220, in execute
    output = self.handle(*args, **options)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py\", line 67, in handle
    self.run(*args, **options)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py\", line 78, in run
    self.inner_run(*args, **options)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py\", line 88, in inner_run
    self.validate(display_num_errors=True)
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/base.py\", line 243, in validate
    from django.core.management.validation import get_validation_errors
  File \"/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py\", line 3, in <module>
    from django.contrib.contenttypes.generic import GenericForeignKey, GenericRelation
  File \"/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/generic.py\", line 7, in <module>
    from django.db import connection
  File \"/usr/local/lib/python2.7/dist-packages/django/db/__init__.py\", line 27, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 81, in __getitem__
    backend = load_backend(db[\'ENGINE\'])
  File \"/usr/local/lib/python2.7/dist-packages/django/db/utils.py\", line 23, in load_backend
    return import_module(\'.base\', backend_name)
  File \"/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py\", line 35, in import_module
    __import__(name)
ImportError: No module named mysql.base
我在Google上搜索了一下,发现如果您使用旧版本的MySQLd,则可以打印此消息。因此,我确保获得了最新版本。并在交互式python shell中测试了导入。没关系。 还有其他建议,为什么这行不通? 如果很重要,我正在研究全新安装的Ubuntu 11.04版本(Windows 7中为Wubi)。 =)     
已邀请:
正确的数据库设置为
\'django.db.backends.mysql\'
。     

要回复问题请先登录注册