How do you set DEBUG to True when running a Django test?

For a specific test inside a test case, you can use the override_settings decorator:

from django.test.utils import override_settings
from django.conf import settings
class TestSomething(TestCase):
    @override_settings(DEBUG=True)
    def test_debug(self):
        assert settings.DEBUG

Leave a Comment