DATABASE_URL environment variable error


#1

I encountered this error with the current Django scaffold:
django.core.exceptions.ImproperlyConfigured: Set the DATABASE_URL environment variable

I was able to resolve this by adding this line of code in the settings.py:
environ.Env.read_env(os.path.join(BASE_DIR, ".env"))


#2

Thanks for the contribution, @lorence! You can make a PR for this issue directly to the Django scaffold and the team will review it and merge it!


#3

@anand where can I locate the Django scaffold repository?


#4

Make sure you’re running pipenv shell before running the app. pipenv will load your .env file.


#5

@Crowdbotics_Dan Yes. Already did those previously and this line of code fixed the issue. environ.Env.read_env(os.path.join(BASE_DIR, ".env"))


#6

@lorence we’re working on making these publicly accessible to field PRs directly! In the meantime, I’ll add you into the repo directly.