+ 1

Django postgresql password

I define my database in my settings.py: Engine: django.db.backends.postgresql, Name: name, User: user, Password: password Host: localhost Now I'm wondering if I have to/should change this part, when I deploy my project on a server. Or do I leave my password hard-coded in settings.py? Thanks for reading!

27th Jan 2021, 6:28 PM
Fu Foy
Fu Foy - avatar
1 Answer
+ 1
When you have to deploy your app use environment variables. E.g. import os ... 'NAME': os.environ['DB_NAME'], 'USER': os.environ['DB_USER'], 'PASSWORD': os.environ['DB_PASS'], ... I hope this helps you.
4th Feb 2021, 1:02 PM
CLAD
CLAD - avatar