我正在开发一个新的 django 项目并遵循本教程。我正在尝试运行“使用 South 进行数据库迁移”步骤,python manage.py syncdb
但出现以下错误:
(editorial)[hookedonwinter@hookedonwinter editorial (master *)]$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/django/core/management/__init__.py", line 77, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/south/management/commands/__init__.py", line 13, in <module>
from south.management.commands.syncdb import Command as SyncCommand
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/south/management/commands/syncdb.py", line 18, in <module>
from south import migration
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/south/migration/__init__.py", line 11, in <module>
from south.models import MigrationHistory
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/south/models.py", line 4, in <module>
class MigrationHistory(models.Model):
File "/Users/hookedonwinter/.virtualenvs/editorial/lib/python2.6/site-packages/django/db/models/base.py", line 97, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
TypeError: Error when calling the metaclass bases
__init__() keywords must be strings
这是我的 settings.py 文件:https ://gist.github.com/pjhoberman/5273653
目前还没有应用程序,只是一个空项目。我猜这是我的一个简单的忽视 - 有什么想法吗?
编辑
从评论:
我还没有任何模型。只是按照那个教程,在我做任何模型工作之前,我试图从 South 开始。
版本:
- Django==1.5.1
- 南==0.7.6
如果我在 settings.py 中注释掉南,我会得到这个错误:
$ python manage.py syncdb
TypeError: Error when calling the metaclass bases __init__() keywords must be strings
编辑2
我重新开始并使用了 django 1.4,它可以工作。
编辑3
我将 python 更新到 2.7 并使用了 django 1.5,一切正常。