Search code examples
databasedjangodjango-south

South migration schemamigration doesn't work


Just to make sure I have the setup right in my current django project, I did the following:

  • added south to installed_apps
  • manage.py syncdb (using windows)
  • manage.py convert_to_south app

I didn't make changes to my database yet but whether or not I do, I run:

  • manage.py schemamigration app --auto

and I get the following errors:

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

What's going on? It's not letting me use schemamigration. Been searching a lot of places and deleting and resetting the database and everything, can't seem to find out what the problem is.

Problem resolved:

Didn't know about south_migrationhistory location. I was always wondering about where some extra information was hanging.


Solution

  • Have a look here: http://south.aeracode.org/ticket/1069

    Its a bug that is fixed in newer South versions. It seems you are using an obsolete version of South(<=0.7.3)