By Jake Steele
Connected Tutorial(This question is a follow-up to this tutorial):
How To Deploy a Django App on App PlatformAs I followed the tutorial I ran into this error
[2021-09-15 19:37:52] File "/workspace/portfoliobackend/settings.py", line 92, in <module>
[2021-09-15 19:37:52] raise Exception("DATABASE_URL environment variable not defined")
[2021-09-15 19:37:52] Exception: DATABASE_URL environment variable not defined
[2021-09-15 19:37:53]
[2021-09-15 19:37:53] ! Error while running '$ python manage.py collectstatic --noinput'.
[2021-09-15 19:37:53] See traceback above for details.
[2021-09-15 19:37:53]
[2021-09-15 19:37:53] You may need to update application code to resolve this error.
[2021-09-15 19:37:53] Or, you can disable collectstatic for this application:
[2021-09-15 19:37:53]
[2021-09-15 19:37:53] $ heroku config:set DISABLE_COLLECTSTATIC=1
[2021-09-15 19:37:53]
[2021-09-15 19:37:53] https://devcenter.heroku.com/article
And I’ve already set the environment variable DATABASE_URL equal to ${db.DATABASE_URL}.
However, when I navigate to the DB it says that it’s being provisioned. And it’s been going on like this for hours. Is there a way to fix the provision changes happening with the DB, or am I doing something else incorrectly in the tutorial?
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!
Thanks for reaching out. The logs look like build logs, not deployment logs. The DATABASE_URL env vars are not available during build time. So it makes sense that the env var is not showing up here.
If you need to do DB migrations we recommend using a Job component or doing those migrations on app startup.
Hope this helps! If you continue having trouble please submit a support ticket.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.