Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23390

Set the DATABASE_URL environment variable

$
0
0

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=postgresPOSTGRES_PORT=5432POSTGRES_DB=marketingPOSTGRES_USER=usernamePOSTGRES_PASSWORD=passwordDATABASE_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?


Viewing all articles
Browse latest Browse all 23390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>