I am trying to create my own kind of project structure by looking at two scoops of django. The project structure looks something like this
.envs
.local
.django
.postgres
.production
.django
.postgres
in postgres inside local, the following items are listed
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=marketing
POSTGRES_USER=username
POSTGRES_PASSWORD=password
DATABASE_URL=postgres://username:password@localhost:5432/marketing
the settings file is divided into 3 parts as base.py, local.py and production.py
in base.py, I have configured the DATABASES
key as following
DATABASES = {
'default': env.db('DATABASE_URL'),
}
However I am getting an error
django.core.exceptions.ImproperlyConfigured: Set the DATABASE_URL environment variable
Though, I have DATABASE_URL
in .envs/.local/.postgres, I am getting above error. Why is that so?