Why cookiecutter-django does not set DATABASE_URL and CELERY_BROKER_URL during entrypoint execution?

641 Views Asked by At

cookiecutter-django does not set env variables for DATABASE_URL and CELERY_BROKER_URL during "entrypoint" file execution in local development environment.

After I manually 'exported' DATABASE_URL and CELERY_BROKER_URL they appeared in environment variables. Why is that?

By manually I mean I got inside the docker container then on the shell I wrote:

export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"

and

export CELERY_BROKER_URL="${REDIS_URL}"
1

There are 1 best solutions below

0
On

It might be because the environment variable DJANGO_READ_DOT_ENV_FILE is set to False by default. Set it to True in your runtime environment and it will start reading the .env file and the DATABASE_URL in it:

export DJANGO_READ_DOT_ENV_FILE=True