[Python] Django SMTPAuthenticationError when using the same variable name for...

Discussão em 'Python' iniciado por Stack, Setembro 25, 2024.

  1. Stack

    Stack Membro Participativo

    I am working on a Django project where I use Gmail for email services. I have the following configuration in my .env file:

    EMAIL_HOST_USER=gmail@gmail.com

    EMAIL_HOST_PASSWORD=password

    And in my settings.py, I load these variables as follows:

    EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')

    EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')

    When I try to send an email through my application, I encounter an SMTPAuthenticationError.

    However, when I change the name of the variable in the .env file, it works fine, but the password is no longer masked. How can I fix this while keeping the password masked?

    Continue reading...

Compartilhe esta Página