-
-
Save NotSqrt/5f3c76cd15e40ef62d09 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(object): | |
def __contains__(self, item): | |
return True | |
def __getitem__(self, item): | |
return "notmigrations" | |
MIGRATION_MODULES = DisableMigrations() |
Looks like you need to alter this slightly on Django 1.11:
def __getitem__(self, item):
return None
Thanks, it still works 👍
Hello,
Any help please
after running :- ./manage.py test --settings groundup.settings_test
Got this Error :- ModuleNotFoundError: No module named 'notmigrations'
Thanks
If your Django version is >= 1.9
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
MIGRATION_MODULES = DisableMigrations()
Awesome, thanks for this
This is available in Django 3.1 onwards as a setting https://docs.djangoproject.com/en/3.1/ref/settings/#migrate
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those who use pytest-django, it already supports commands to define db behaviour on tests:
http://pytest-django.readthedocs.io/en/latest/database.html
@cjw296
You can have a stage env with a different pytest.ini where you test migrations.