当前位置:  开发笔记 > 编程语言 > 正文

set_autocommit得到了一个意外的关键字参数'force_begin_transaction_with_broken_autocommit'

如何解决《set_autocommit得到了一个意外的关键字参数'force_begin_transaction_with_broken_autocommit'》经验,为你挑选了1个好方法。

我刚刚升级到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并在设置中保留事务挂钩引擎,则会出现此错误.



1> freyley..:

啊哈!如果您在使用django-transaction-hooks时升级到Django 1.9并在设置中保留事务挂钩引擎,则会出现此错误.

推荐阅读
TXCWB_523
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有