Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Another shot at this problem ..
class DisableMigrations(dict):
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
DATABASES = DisableMigrations()
MIGRATION_MODULES = DisableMigrations()
@FavorMylikes

This comment has been minimized.

Copy link
Owner Author

FavorMylikes commented Dec 13, 2017

Migrations for django 1.10 has two part,please look at load_disk and recorder

The part of load_disk is for migrations of app model
And the part of recorder for database connection
For the version before 1.9 we need set MIGRATION_MODULES={'do.not.migrate':'notmigrations'} when you are running test
Now we need set it None like MIGRATION_MODULES={'do.not.migrate':None}
So if we do not want make migrations for any app, just subclass a dict and return None for getitem function , and do the same of DATABASES, that is the right thing you need

PS: For command, you need to specify --setting=module.path.settings_test_snippet after test
PPS If you are working at pycharm ,do not set --settings options at Run/Debug configurations, just add path of settings_test_snippet.py at Custom setting. That just be fine!!

enjoy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.