Condado
Condado

Reputation: 65

Django: how to store email credentials when sending email from a Django application

What is a standard or safe way to store my Google Workspace email credentials in my first Django project?

I've tried to store the password in an .env file, but I get all kinds of error messages (e.g., "decouple module not recognized"--despite my alternately using pip install decouple and pip install python-decouple). But more importantly, I suspect it's not the best approach anyway.

My research seems to whittle the options down to eliminating my password altogether and to somehow API into Google from within my app (to send out emails to my customers from my Google Workspace email).

Is that would you recommend? Is there an simpler/better way?

Upvotes: -4

Views: 80

Answers (1)

Kuth
Kuth

Reputation: 15

From my experience to store email credential, Actually we can store in .ENV file and read load the file properly to Django settings. you can debug with print test the credential test.

.ENV

SECRET_KEYS= credential herer

SETTINGS.py

GET_KEY = os.getenv("SECRET_KEYS", default="")

Upvotes: 0

Related Questions