dimanche 31 décembre 2017

Modifying Django settings in tests

From Django docs:

You shouldn’t alter settings in your applications at runtime. For example, don’t do this in a view:

from django.conf import settings

settings.DEBUG = True   # Don't do this!

The only place you should assign to settings is in a settings file.

I've noticed that Django testing code does alter settings. Why is it ok to do it there?

Aucun commentaire:

Enregistrer un commentaire