I deployed a small Sinatra app last night to Heroku for the new KickoffLabs API.
Most of the Sinatra apps I have deployed in the past have been small prototypes and used the inline Sinatra app style.
However, in this case, I made the decision early on to use the Sinatra::Base class style since we plan on growing the API codebase (ie, we are going to keep it around for a long time).
Everything was working as expected locally, but once I deployed to Heroku none of the static files in the public directories were rendering properly (all were 404’ing).
It turns out that when you use the Sinatra::Base class style, you need to set the public directory explicitly like this:
1 2 3 | |
Now this makes a lot of sense since in hindsight, but took me longer than I would like to admit to figure out. Hopefully this post and a little Google foo will save others a couple of hours.