python - 在ubuntu上将django sqlite数据库迁移到mysql

标签 python mysql django

我尝试将 django mysqlite 数据库迁移到 mysql 数据库,但无法将 sqlite 迁移到 mysql。我尝试了所有的解决方案,但没有用。

我的代码

设置.py

DATABSES = {
     'default' :{
         'ENGINE' : 'django.db.backends.mysql',
         'NAME'  :'MasterQuote',
         'USER'  : 'root',
         'PASSWORD' : 'root',
         'HOST' : 'localhost',
         'PORT' : ''
     }
}

错误回溯:

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/commands/migrate.py", line 79, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/loader.py", line 206, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/recorder.py", line 61, in applied_migrations
    if self.has_table():
  File "/usr/local/lib/python3.6/dist-packages/django/db/migrations/recorder.py", line 44, in has_table
    return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/base/base.py", line 255, in cursor
    return self._cursor()
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/dummy/base.py", line 20, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.

我尝试了所有类型的解决方案。我没有添加任何数据。我的代码只是初始阶段

有人请帮忙解释一下为什么会发生这个错误吗?

最佳答案

尝试更正 DATABASES 的拼写,您已经编写了 DATABSES

关于python - 在ubuntu上将django sqlite数据库迁移到mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50093847/

相关文章:

c# - 修改一个点,UnboundNameException

文件中生成的 PHP post 变量

django - Django MiddleWare 排序的实用规则?

Django 应用程序无法识别静态文件

python - 刷新access token报 "invalid_grant"错误的情况?

python - 打印 joblib 中函数的输出

php - 这个代码是什么意思...?

php - 表单提交处理和生成

python - 玩家和奖品的正确模型关系?

python - 将自定义类别分配给 json 数据 - pandas