【问题标题】:south, django 1.2 and supports_transaction error南,django 1.2 和 supports_transaction 错误
【发布时间】:2012-03-05 23:29:51
【问题描述】:

我正试图去南方工作,但我总是遇到错误。我什至严格遵循教程。

所以我做了一个简单的骑士模型,并在APPS中用南运行syncdb,但没有(测试应用程序)。

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
#    'whatever.sth',
    'south',
#    'sth',
)

我从“某事”中删除评论,然后运行:

user@pc:~/projectdir/whatever$ python manage.py schemamigration sth --initial
Creating migrations directory at '/pathtoproject/whatever/sth/migrations'...
Creating __init__.py in '/pathtoproject/whatever/sth/migrations'...
 + Added model sth.Knight
Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate sth

现在迁移:

user@pc:~/pathtoproject/whatever$ python manage.py migrate sth
Running migrations for sth:
  - Migrating forwards to 0001_initial.
 > sth:0001_initial
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 438, 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/lib/pymodules/python2.7/south/south/management/commands/migrate.py", line 107, in handle
    ignore_ghosts = ignore_ghosts,
  File "/usr/lib/pymodules/python2.7/south/south/migration/__init__.py", line 219, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/usr/lib/pymodules/python2.7/south/south/migration/migrators.py", line 235, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/usr/lib/pymodules/python2.7/south/south/migration/migrators.py", line 310, in migrate_many
    result = self.migrate(migration, database)
  File "/usr/lib/pymodules/python2.7/south/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration)
  File "/usr/lib/pymodules/python2.7/south/south/migration/migrators.py", line 104, in run
    if not south.db.db.has_ddl_transactions:
  File "/usr/lib/pymodules/python2.7/south/south/db/generic.py", line 29, in __get__
res = instance.__dict__[self.func.__name__] = self.func(instance)
  File "/usr/lib/pymodules/python2.7/south/south/db/generic.py", line 110, in has_ddl_transactions
    if connection.features.supports_transactions:
AttributeError: 'DatabaseFeatures' object has no attribute 'supports_transactions'

我在 settings.py 中的数据库设置是:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '/pathtoproject/whatever/db',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # 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.
    }
}

谁能告诉我怎么了?

【问题讨论】:

    标签: django django-south


    【解决方案1】:

    "这个bug在South的开发版本中已经修复,可以通过安装使用

    "pip install -U South==dev"
    

    (仅在 Django 1.2 及以下版本中出现)

    安德鲁”

    我从南方邮件列表中得到的答案。奇迹般有效。在这里重新发布作为答案,这样更容易为其他人找到解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-14
      • 2011-11-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-21
      • 2013-11-17
      相关资源
      最近更新 更多