I built a django app on my local machine, and then used this tutorial to deploy it with app platform (https://docs.digitalocean.com/tutorials/app-deploy-django-app/) The deployment was successful.
However, now when I try to run my django app locally to continue development, I’m getting the following error:
…/settings.py", line 95, in <module> raise Exception(“DATABASE_URL environment variable not defined”) Exception: DATABASE_URL environment variable not defined
Current settings in settings.py: DEVELOPMENT_MODE = os.getenv(“DEVELOPMENT_MODE”, “False”) == “True”
DEBUG = os.getenv(“DEBUG”, “False”) == “True”
I am unsure of how to reset my settings.py file so that it points to a local sqlite3 db for development.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
👋 @43e88fede83e446f9e392debd41d3c
Giving that tutorial a quick read over, it looks like you’ll need to set an environment variable to indicate that you’re in a development environment.
So in your dev env, set
DEVELOPMENT_MODE=true
.This way the code will use a sqlite db instead of looking for a postgres instance, snippet from the tutorial:
The dev env defaults to being disabled just above the snippet above: