我正努力向南工作,但我总是遇到错误。我甚至严格遵循教程。
所以我制作了简单的Knight模型,并在APPS中使用south运行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',
)
我从'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.
}
}
任何人都可以告诉我出了什么问题?
答案 0 :(得分:0)
“此错误已在South的开发版本中修复,您可以使用
进行安装"pip install -U South==dev"
(仅在Django 1.2及以下版本中出现)
安德鲁“
回答我是从南方邮件列表中得到的。奇迹般有效。重新发布此处作为答案,因此更容易为其他人找到解决方案。