3π
I ensured that the environment variable is set to my actual password within bash_profile
If you are following best practices and running Django in a virtual environment, it has a different set of environment variables. I suspect if you changed your setting to os.environ['email_password']
you would get a KeyError
, because that environment variable is not set.
There are a number of ways to export environment variables, but just to prove to yourself that this is the problem, export the value right in the command line with your virtual environment enabled, then run your project and try sending the email.
Edit
Since youβre using pipenv, you can simply add a .env file in the root of your project, and pipenv will automatically set those environment variables for you when you activate the virtual environment.
.env
SECRET_KEY=asolidsecretkey
email_password=somesecurepassword
...