如何(有意)跳过使用Django syncdb的应用程序

Bwy*_*yss 3 django django-models django-south

我有几个django应用程序:

INSTALLED_APPS = (
    'geonode.exposure',
    'geonode.isc_viewer',
    'geonode.geodetic',
    'geonode.observations',
    'geonode.ged4gem',
Run Code Online (Sandbox Code Playgroud)

我需要管理所有这些,除了一个syncdb.我怎样才能syncdb故意跳过geonode.exposure申请?

更新: 我没有描述完整配置,请允许我详细介绍:我正在使用南来管理除了曝光之外的所有应用程序的数据库迁移和固定装置.曝光应用程序正在访问外部数据库并正在使用路由器这样做(这就是我希望它被syncdb跳过的原因).我的路由器设置如下所示:

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
Run Code Online (Sandbox Code Playgroud)

南不尊重allow_syncdb方法吗?是曝光应用程序南部运行syncbd因为我没有迁移它?

msc*_*msc 5

您可以managed = False在模型的Meta类中使用.这样,syncdb将不会创建应用程序的表.有关文档的更多信息.