-
-
Save FavorMylikes/1ea67551005555b6eef2202be0e6be9b to your computer and use it in GitHub Desktop.
Another shot at this problem ..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DisableMigrations(dict): | |
def __contains__(self, item): | |
return True | |
def __getitem__(self, item): | |
return None | |
DATABASES = DisableMigrations() | |
MIGRATION_MODULES = DisableMigrations() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 modelAnd the part of
recorder
for database connectionFor the version before 1.9 we need set
MIGRATION_MODULES={'do.not.migrate':'notmigrations'}
when you are running testNow 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 needPS: For command, you need to specify
--setting=module.path.settings_test_snippet
aftertest
PPS If you are working at
pycharm
,do not set--settings
options atRun/Debug configurations
, just add path ofsettings_test_snippet.py
at Custom setting. That just be fine!!enjoy