Apprentice Programmer
Apprentice Programmer

Reputation: 1515

unable to display images on heroku

When i run the website locally, it works fine.However, after pushing to heroku, its displaying as a broken image

The pictures are in my /assets/images/ folder

images are called in my static page like this

<img src="assets/blank_avatar_male.jpg" alt="blank_male_avatar">

Ive tried changing the path to /assets/images/jpeg and it and repushed. No luck so far. Any suggestions on how to fix this?

Upvotes: 0

Views: 167

Answers (2)

John Beynon
John Beynon

Reputation: 37507

My guess is that you don't have config.serve_static_assets set to true in your production.rb file.

The simplest solution is to include the rails_12factor gem which will do this for you

Upvotes: 2

Optimus Pette
Optimus Pette

Reputation: 3400

try compiling your assets locally like this:

RAILS_ENV=production bundle exec rake assets:precompile

and then push to heroku

Upvotes: 0

Related Questions