1
You don’t need to define the EMAIL_BACKEND
setting (it has a default), but you do need to define a setting module. You can set the DJANGO_SETTINGS_MODULE
in your shell environment, or set os.environ['DJANGO_SETTINGS_MODULE']
to point to your settings module.
Note that calling python manage.py shell
will set up the Django environment for you, which includes setting DJANGO_SETTINGS_MODULE
and calling django.setup()
. You still need to call setup_test_environment()
to manually run tests in your python shell.
Source:stackexchange.com