Black Lives Matter. Please consider donating to Black Girls Code today.

Hiding password values

In my plot dashboard project, I am using plotly simple auth,

this is standard in plolty simple HTTP auth,

Issue 1, I need to hide my password pairs,

in the ploty docs, we see this configuration,

Keep this out of source code repository - save in a file or a database VALID_USERNAME_PASSWORD_PAIRS = [ [‘hello’, ‘world’] ] app = dash.Dash(‘auth’) auth = dash_auth.BasicAuth( app, VALID_USERNAME_PASSWORD_PAIRS )

here is my repo,

Basically, I need to hide my password,

my app is on Heroku ,

Can someone plaese help me with this ??,
Thank you

Try setting environment variables on heroku and then referencing them in your code using os.environ['MY_USERNAME'] where MY_USERNAME is a variable you set on Heroku.

Thanks, but do I need to make a env file or a config file ? to reference the username & password & then inject through the herokucli,


Once you add the environment variables to your heroku container I think you can reference them using os.environ in your code directly where you need your password/username.

If I createplotly2 plotly1 plotly a .env file declare my USERNAME_PASSWORD_PAIRS=(not sure of the correct syntax for this file !!),

install python-dotenv import my config file into my app,

But I am missing a great deal here I think

If the list of user/password is big and static, I would put it on a private cdn (eg: AWS S3) and load it from there.

For a dynamic list you would need a database.

No its just a password & username,

Should I not be creating a env file a config file, then declare the values in the .env file gitgnore the .env file,

Reference the values in the config file

import os
basedir = os.path.abspath(os.path.dirname(file))



here is my repo it is 1 commit behind, I haven’t pushed any of this config code yet

I think now I need to just fix my app file