7đź‘Ť
âś…
Thanks to @IainShelvington and @ivissani, I’ve figured it out. I use wagtail cms on top of django and created the project using “wagtail start mysite”. for more information see this.
in wagtail standard project structure, there are base.py, dev.py and production.py instead of settings.py.
The Email settings was in base.py but in dev.py, EMAIL_BACKEND was overwritten. This is the dev.py when you create a django project using wagtail:
from .base import *
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'MY-SITE-KEY'
# SECURITY WARNING: define the correct hosts in production!
ALLOWED_HOSTS = ['*']
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
try:
from .local import *
except ImportError:
pass
So I fixed the problem by removing EMAIL_BACKEND from dev.py
👤HsnVahedi
0đź‘Ť
Start your python file with this:
import os
import sys
import django
django.setup()
# rest of your code
from django.conf import settings
imports your settings but it doesn’t set it as os environment.
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
– this also should work
👤Michael Stachura
- [Django]-Django app under uwsgi failing to start when using postgresql database
- [Django]-Django message once logged in
Source:stackexchange.com