南迁移模式迁移不起作用

时间:2012-09-14 22:09:06

标签: database django django-south

为了确保我在当前的django项目中设置正确,我做了以下事情:

  • 向南添加到installed_apps
  • manage.py syncdb(使用Windows)
  • manage.py convert_to_south app

我没有对我的数据库进行更改,但无论我是否这样做,我都会运行:

  • manage.py schemamigration app --auto

我收到以下错误:

Traceback (most recent call last):
  File "manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 443, in execute
_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 382, in execute

    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196, in run_from_ar
gv
    self.execute(*args, **options.__dict__)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\south\management\commands\schemamigration.py", line 98, i
n handle
    old_orm = last_migration.orm(),
  File "C:\Python27\lib\site-packages\south\utils.py", line 62, in method
    value = function(self)
  File "C:\Python27\lib\site-packages\south\migration\base.py", line 418, in orm
    return FakeORM(self.migration_class(), self.app_label())
  File "C:\Python27\lib\site-packages\south\orm.py", line 46, in FakeORM
    _orm_cache[args] = _FakeORM(*args)
  File "C:\Python27\lib\site-packages\south\orm.py", line 125, in __init__
    self.models[name] = self.make_model(app_label, model_name, data)
  File "C:\Python27\lib\site-packages\south\orm.py", line 318, in make_model
    field = self.eval_in_context(code, app, extra_imports)
  File "C:\Python27\lib\site-packages\south\orm.py", line 236, in eval_in_context
    return eval(code, globals(), fake_locals)
  File "<string>", line 1
    SouthFieldClass(default=datetime.datetime(2012, 9, 14, 20, 46, 3, 957000, tzinfo=<UTC>))
                                                                                     ^
SyntaxError: invalid syntax

发生了什么事? 这不是让我使用模式迁移。一直在搜索很多地方并删除和重置数据库和所有内容,似乎无法找出问题所在。

问题已解决:

不知道南移民历史的位置。我总是想知道一些额外的信息在哪里悬挂。

1 个答案:

答案 0 :(得分:4)

看看这里:http://south.aeracode.org/ticket/1069

它是一个在较新的南版本中修复的错误。您似乎使用的是过时版本的South(&lt; = 0.7.3)