4👍
Heh, I guess I’ll answer my own question (RTFM!)…
http://docs.djangoproject.com/en/dev/topics/db/multi-db/#an-example
def allow_syncdb(self, db, model):
...
That’s a definite start…
1👍
If you don’t need syncdb
, don’t run it, simple as that. Updating the database is what it does, so if you don’t need that, you shouldn’t run it – it doesn’t do anything else.
However if you’re actually asking how to prevent syncdb from running at all, one possibility would be to define a ‘dummy’ syncdb command inside one of your apps. Follow the custom management command instructions but just put pass
inside the command’s handle
method. Django will always find your version of the command first, making it a no-op.
- [Django]-How to make Django use two different databases based on debug flag
- [Django]-Starting first Django project errors
0👍
This issue came up for me when working with read-only mirrors of Microsof SQL Server databases (uhhg). Since you can’t selectively run syncdb
on a single app or database. But you have to run syncdb
when you first create a new Django project or install an new app that requires it (like south
). What I did was to put my read-only database in its own Django app and then add an empty South migration to that app. That way syncdb
thinks south is handling db setup for those apps, and south
doesn’t do anything to them!
manage.py schemamigration ap_with_read_only_database --empty initial_empty_migration_that_does_nothing
That leaves you free to manage the schema of that db outside of django.
- [Django]-Django: after form.is_valid check, cleaned_data is missing the image field
- [Django]-Django REST Framework: nested serializer not serializing
- [Django]-Sorl-thumbnail: resize original image before saving?