python - 测试/应用迁移到 new database(upgraded existing Django 1.5 project to Django 1.7 ) 时的Django 1.7迁移问题

  显示原文与译文双语对照的内容
0 0

我已经将旧 Django 1.5版本项目升级到新的Django 1.7版本

我的主要问题是迁移。

我按照从南方升级到 Django 迁移( ) 来进行新迁移。

在运行测试用例时,当创建testDB时出错,并且在应用迁移到新数据库服务器时出错。

Applying someapp.0001_initial...Traceback (most recent call last):
 File"manage.py", line 18, in <module>
 execute_from_command_line(sys.argv)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
 utility.execute()
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
 self.execute(*args, **options.__dict__)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
 output = self.handle(*args, **options)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 160, in handle
 executor.migrate(targets, plan, fake=options.get("fake", False))
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 63, in migrate
 self.apply_migration(migration, fake=fake)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 97, in apply_migration
 migration.apply(project_state, schema_editor)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 107, in apply
 operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/migrations/operations/fields.py", line 37, in database_forwards
 field,
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/backends/schema.py", line 390, in add_field
 self.execute(sql, params)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/backends/schema.py", line 99, in execute
 cursor.execute(sql, params)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 81, in execute
 return super(CursorDebugWrapper, self).execute(sql, params)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
 return self.cursor.execute(sql, params)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)
 File"/home/user/django17/django17_env/local/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
 return self.cursor.execute(sql, params)
django.db.utils.InternalError: current transaction is aborted, commands ignored until end of transaction block

有谁能帮助我,迁移的错误是什么?

时间:原作者:3个回答

0 0

似乎是:

0001_initial 。

导致错误这可能是从south监视的迁移? 我建议你清空所有迁移包( 但不是初始化文件),并使用( Windows ) 在命令行中进行迁移: !

$ cd <your projects'-path>
$ python manage.py makemigrations
$ python manage.py migrate
原作者:
...