I'm setting up django with docker and I can't really get what's the correct way to setup the setting.py
For example, the database I've right now in the setting.py is:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': os.environ['db_name'],
        'USER': os.environ['db_user'],
        'PASSWORD': os.environ['db_password'],
        'HOST': 'db',
        'PORT': '5432',
    }
}
where db_name, db_user, db_password are set in an enviroment file. db is instead a --link (docker run --link mydb:db ..).
Now, it seems to work, but I'm not really sure I should do like this.
Is this the right way to setup the settings? Especially where the secrete things should be placed, what's the way to call variables in the environment (apparently docker is creating DB_ variables), and when/how to use the linked containers in the settings (with the name or with env variables?).
Is there a way to use 'db' or an enviroment variable as host? I would like to have so beacuse I may specify the db as link or inside the .env file.
 
     
     
    