django testing with local settings

前端 未结 3 1513

Python 2.7 Django 1.2

I am getting odd local_settings behavior when I am testing a Django app. I have my /settings.py set up like this:<

相关标签:
3条回答
  • 2021-01-16 09:32

    I recall reading that you're not supposed to change settings values in any way at runtime, it causes problems.

    0 讨论(0)
  • 2021-01-16 09:42

    Use --settings option when running tests

    python manage.py test --settings=mysite.settings_local
    
    0 讨论(0)
  • 2021-01-16 09:58

    This is an intentional choice within Django:

    Regardless of the value of the DEBUG setting in your configuration file, all Django tests run with DEBUG=False. This is to ensure that the observed output of your code matches what will be seen in a production setting.

    Ref: https://docs.djangoproject.com/en/dev/topics/testing/#other-test-conditions

    0 讨论(0)
提交回复
热议问题