“django.db.utils.ProgrammingError: relation ”app_user“ does not exist” during manage.py test

前端 未结 6 787
你的背包
你的背包 2020-12-10 15:02

My setup:

  • Django 1.8.3
  • Python 2.7.10
  • Ubuntu 14.04
  • django-two-factor-auth==1.2.0

I get the following error when I ru

6条回答
  •  长情又很酷
    2020-12-10 15:28

    Got the same issue, and since it happens on ./manage.py test, your migrations may be broken.
    Since Django 1.7, there is a new setting called MIGRATION_MODULES, in which you configure your app's migration modules.
    Adding the following workaround in settings.py (found here) skips migrations on tests, and solved it for me:

    class DisableMigrations(object):
    
        def __contains__(self, item):
            return True
    
        def __getitem__(self, item):
            return "notmigrations"
    
    MIGRATION_MODULES = DisableMigrations()
    

提交回复
热议问题