I have a django + vue project built using django cookie cutter with docker. Because I’ve done this with docker, after starting my containers, I can’t use the normal python manage.py command
command. I instead get this error message django.core.exceptions.ImproperlyConfigured: Set the DATABASE_URL environment variable
. I have searched everywhere to figure out how to fix this but I can’t find anyone with a fix for this.
So my question is:
- Is there a fix for the DATABASE_URL error I am getting? — Steps to reproduce are follow these cookie cutter django with docker instructions and try to run
python manage.py migrate
.
EDIT:
I should note that I have tried to export the db url and that works temporarily. Other issues arise because some how multiple env variables are not being read correctly. If you follow the setup of the django + docker and export db url you will see what I mean.
3
You probably don’t have local settings as env variable set
so you have to run it as
python manage.py migrate --settings=config.settings.local
or add it to env as
DJANGO_SETTINGS_MODULE = 'config.settings.local'
1