security database information

How can i hide database information like passowrd and host in settings.py so i can deploy my website from github repo

You don’t. You set up your settings to get that information from outside your project - like from environment variables.

See:

yes, i did with .env file i used python-decouple it worked locally but when i push the code to github and use this project to deploy it on railway give me this error in ‘deploy log’
the error:
File “/opt/venv/lib/python3.10/site-packages/decouple.py”, line 90, in get
raise UndefinedValueError(‘{} not found. Declare it as envvar or define a default value.’.format(option))

decouple.UndefinedValueError: DB_NAME not found. Declare it as envvar or define a default value.

if i replced decouple.config(‘VALUE’) with os.environ.get(‘VALUE’) ,…will it work?

This all depends upon your deployment process.

Since your .env files or other environment settings aren’t going to be in your repo, you have to figure out how you’re going to get those settings deployed to your target production environment.

1 Like

i solved the problem thanks , i set Variables inside railway and it worked!

pls can you help me out because i am having the same challenges?

We can try, but I would suggest that you open up a new topic and provide all the details about the challenges you are facing.