Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide password when checking config file in git [duplicate]

Possible Duplicates:
What is the best practice for dealing with passwords in github?
How can I track system-specific config files in a repo/project?

Hi,

I would like to hide

DATABASE_NAME = ''
DATABASE_USER = ''
DATABASE_PASSWORD = ''
DATABASE_HOST = '' 

Line 13 to 17 of the default Django settings.py file when checking it in github.

I still want to check it in tho, because I am adding modifications from time to time. I just want these four lines to always be set to empty.

like image 330
Martin Avatar asked Nov 27 '22 15:11

Martin


1 Answers

You could also have an extra settings file which holds passwords and just import them in your main settings.py

For example:

settings.py

DATABASE_PASSWORD = ''

try:
   from dev_settings import *
except ImportError:
   pass

dev_settings.py

DATABASE_PASSWORD = 'mypassword'

And keep dev_settings.py out of revision control.

like image 138
Davor Lucic Avatar answered Jan 05 '23 14:01

Davor Lucic