Python Quick Tip: Hiding Passwords and Secret Keys in Environment Variables (Windows)
Why Stack Overflow recommends it
Stack Overflow users link it when answering Django, Flask and SMTP questions where credentials or SECRET_KEY values need to be moved out of code and set as environment variables on Windows.
Recommended by 2 people across 2 different months, 2019 to 2022.
What it is
A short Python tutorial by Corey Schafer showing how to keep passwords and secret keys out of source code by storing them in Windows environment variables and reading them with os.environ. It is the Windows companion to a Mac and Linux version of the same tip.
What people said
Recommends requiem · 2019-06 · Stack Overflow · on “Error occuring while sending test mail using flask-mail”
You will want to use os.environ example: app.config['MAIL_USERNAME'] = os.environ.get('EMAIL_USER', 'my@email.com') app.config['MAIL_PASSWORD'] = os.environ.get('EMAIL_PASS', 'mypassword') or set environment variables windows: [this video] linux: [LINK]
Recommends MansouriAla · 2020-04 · Stack Overflow · on “How does SECRET_KEY = os.environ['SECRET_KEY'] in Django work?”
I just was running into same problem and it's just fixed from a minute ago i'm on windows so if you are too just follow this video super fast super easy : [this video] video title: Python Quick Tip: Hiding Passwords and Secret Keys in Environment Variables (Windows) he has some explanation on about it in mac and linux also just search for: Python Quick Tip: Hiding Passwords and Secret Keys in Environment Variables mac and linux
Cites Maxy · 2022-07 · Stack Overflow · on “Django SMTPAuthenticationError”
This is not exactly an answer to your question. But considering privacy and security of your google account, use Environment Variables in Advanced system settings. And access using "os.environ.get('Host_Email') and ('Host_Pass)" instead of putting your email and password in your code. [this video]