In my app an user has the ability to upload their logo to display on their profile page (using Carrierwave + s3).
On my local app the image path is this: https://s3.amazonaws.com/iemarkt/uploads/user/logo/squaredeye_336x336.jpg
But on my Heroku deployed app the image path is "/assets/", which is causing an error and not letting the user upload the image.
Whenever I try to upload a file with Carrierwave + s3 on my Heroku app I get this error "We're sorry, but something went wrong.", looking into my log I see this error:
2012-08-20T21:18:56+00:00 app[web.1]: Started GET "/assets/" for 24.90.124.181 at 2012-08-20 21:18:56 +00002012-08-20T21:18:56+00:00 app[web.1]:2012-08-20T21:18:56+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets"):
My store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/"
I unccomented this line in my production.rb (I read that Heroku uses Nginx, I dont know if there's something else I need to do to get Nginx to work.)
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
I really don't know why the path doesn't lead to my s3 account.
Here's my app
I just tried to deploy your app and it works fine, see my user has an image uploaded
http://young-reaches-9187.herokuapp.com/deals/1
The only thing I changed was in the carrier wave settings, the region name was wrong: you were trying to use the region
'eu-east-1'
which doesn't exists, so I changed it to : 'us-east-1'
The full list of regions is available here : http://docs.amazonwebservices.com/general/latest/gr/rande.html
By the way you SHOULD NOT write your AWS credentials in your app. For instance I just uploaded to your bucket, but I could have detroyed your files. You should use environment variables.
You should also add you database.yml in your .gitignore.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.