Static folder - Not connected in Heroku

Hello all,

I recently took a minimal Django app live on Heroku. The problem is I can’t get the static images and CSS file to connect. I’ve added the necessary files like the Procfile to no avail.

Any assistance is greatly, appreciated.

You need to use whitenoise to serve static files on Heroku. See Django and Static Assets | Heroku Dev Center

I also notice an SQLite database in your GitHub repo. Two things:

  1. You shouldn’t do that if you want people using your live site to be able to add new shops etc. Add the file name to a .gitignore file in the repo so that it doesn’t get checked in.
  2. Aside from that, you can’t use sqlite on Heroku if you want to be able to update the database (i.e. add new shops or change existing ones). Heroku’s filesystem is “ephemeral” which means that the SQLite database file will be replaced occasionally and you’ll lose any changes. You’ll need to add a Postgres database add-on, which will cost a bit of money (I think $5/month for the smallest).

This was super helpful. Thanks for the quick reply!