Django postgresql password | Sololearn: Learn to code for FREE!


Django postgresql password

I define my database in my 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 Thanks for reading!

1/27/2021 6:28:07 PM

Fu Foy

1 Answer

New Answer


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.