+ 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!
1 Respuesta
+ 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.