我刚刚升级到Django 1.9,我得到了这个错误,当我运行测试时,它似乎完全存在于django堆栈中.
File "~/.virtualenvs/env/lib/python2.7/site-packages/django/test/runner.py", line 482, in setup_databases self.parallel, **kwargs File "~/.virtualenvs/env/lib/python2.7/site-packages/django/test/runner.py", line 726, in setup_databases serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True), File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/backends/base/creation.py", line 70, in create_test_db run_syncdb=True, File "~/.virtualenvs/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 119, in call_command return command.execute(*args, **defaults) File "~/.virtualenvs/env/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute output = self.handle(*args, **options File "~/.virtualenvs/env/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 89, in handle executor = MigrationExecutor(connection, self.migration_progress_callback) File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__ self.loader = MigrationLoader(self.connection) File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/migrations/loader.py", line 49, in __init__ self.build_graph() File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/migrations/loader.py", line 176, in build_graph self.applied_migrations = recorder.applied_migrations() File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations self.ensure_schema() File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 56, in ensure_schema with self.connection.schema_editor() as editor: File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 84, in __enter__ self.atomic.__enter__() File "~/.virtualenvs/env/lib/python2.7/site-packages/django/db/transaction.py", line 184, in __enter__ connection.set_autocommit(False, force_begin_transaction_with_broken_autocommit=True) TypeError: set_autocommit() got an unexpected keyword argument 'force_begin_transaction_with_broken_autocommit'
freyley.. 12
啊哈!如果您在使用django-transaction-hooks时升级到Django 1.9并在设置中保留事务挂钩引擎,则会出现此错误.
啊哈!如果您在使用django-transaction-hooks时升级到Django 1.9并在设置中保留事务挂钩引擎,则会出现此错误.