lundi 22 août 2016

django testing without email backend

I want to test a view in my Django application. So I open the python shell by typing pyton and then I type from django.test.utils import setup_test_environment. It seems to work fine. Then I type setup_test_environment() and it says

django.core.exceptions.ImproperlyConfigured: Requested setting EMAIL_BACKEND, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

I don't need to send mails in my test, so why does Django wants me to configure an email back-end ?

Are we forced to configure an email back-end for any test even if it doesn't need it ?

Aucun commentaire:

Enregistrer un commentaire