Search code examples
djangodjango-modelsdjango-south

How to (intentionally) skip an app with Django syncdb


I have several django applications:

INSTALLED_APPS = (
    'geonode.exposure',
    'geonode.isc_viewer',
    'geonode.geodetic',
    'geonode.observations',
    'geonode.ged4gem',

I need to manage all of them except one with syncdb. How can I get syncdb to intentionally skip the geonode.exposure application?

Update: I did not describe the full configuration, please allow me to go into more detail: I am using south to manage db migrations and fixtures for all the apps except exposure. The exposure app is accessing an external database and is using a router to do so (this is why I want it to be skipped by syncdb). My router settings look like this:

class GedRouter(object):
    def db_for_read(self, model, **hints):
        "Point all operations on ged models to 'geddb'"
        if model._meta.app_label == 'exposure':
            return 'geddb'
        return 'default'

    def allow_syncdb(self, db, model):
        if db == 'geddb' or model._meta.app_label == "ged":
            return False # we're not using syncdb on our legacy database
        else: # but all other models/databases are fine
            return True

Is south not respecting the allow_syncdb method? is south running syncbd on the exposure app because I do not have a migration for it?


Solution

  • You can use managed = False in the model's Meta class. This way, syncdb won't create the app's tables. More information on the documentation.