只是爲了確保我的設置就在我目前的Django項目,我做了以下內容:南遷schemamigration不起作用
- 南加入到INSTALLED_APPS
- manage.py執行syncdb(使用Windows )
- manage.py convert_to_south應用
我沒有更改我的數據庫,但是我是否這樣做,我跑:
- manage.py schemamigration應用--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
這是怎麼回事? 它不讓我使用schemamigration。一直在尋找很多地方,並刪除和重置數據庫以及所有內容,似乎無法找出問題所在。
問題解決:
不知道south_migrationhistory位置。我一直想知道一些額外的信息掛在哪裏。
向我們顯示您的models.py。 – dannyroa
剛剛添加,謝謝。 – dtc
nvm,問題解決了 – dtc