Ticket #232 (closed defect: fixed)

Opened 6 years ago

Last modified 5 years ago

South produces error: The model 'category' from the app 'main' is not available in this migration.

Reported by: Stavros Korokithakis <stavros@…> Owned by: andrew
Priority: major Milestone: 0.6.1
Component: commands Version: 0.6
Keywords: Cc:


I have converted my app to South as per the tutorial, and it worked fine when I tried it on my Windows PC. However, on OS X with an sqlite database, South produces this error when I try to migrate a new db to it:

While loading migration 'main.0001_initial':
Traceback (most recent call last):
  File "./manage.py", line 12, in <module>
  File "/lib/python2.5/site-packages/django/core/management/__init__.py", line 362, in execute_manager
  File "/lib/python2.5/site-packages/django/core/management/__init__.py", line 303, in execute
  File "/lib/python2.5/site-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/lib/python2.5/site-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/lib/python2.5/site-packages/south/management/commands/migrate.py", line 81, in handle
    skip = skip,
  File "/lib/python2.5/site-packages/south/migration.py", line 396, in migrate_app
    tree = dependency_tree()
  File "/lib/python2.5/site-packages/south/migration.py", line 104, in dependency_tree
    tree = all_migrations()
  File "/lib/python2.5/site-packages/south/migration.py", line 99, in all_migrations
    for app in get_migrated_apps()
  File "/lib/python2.5/site-packages/south/migration.py", line 84, in get_migration
    migclass.orm = FakeORM(migclass, get_app_name(app))
  File "/lib/python2.5/site-packages/south/orm.py", line 61, in __init__
    self.models[name.lower()] = self.make_model(app_name, model_name, data)
  File "/lib/python2.5/site-packages/south/orm.py", line 186, in make_model
    field = self.eval_in_context(code, app)
  File "/lib/python2.5/site-packages/south/orm.py", line 121, in eval_in_context
    return eval(code, globals(), fake_locals)
  File "<string>", line 1, in <module>
  File "/lib/python2.5/site-packages/south/orm.py", line 85, in __getitem__
    raise KeyError("The model '%s' from the app '%s' is not available in this migration." % (model, app))
KeyError: "The model 'category' from the app 'main' is not available in this migration."

Change History

comment:1 Changed 6 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.6.1

Could you attach the migration file?

comment:2 Changed 5 years ago by andrew

  • Status changed from assigned to closed
  • Resolution set to fixed

This is fixed in #226, in the sense that the correct error now gets raised.

Note: See TracTickets for help on using tickets.