Rails 4: assets not loading in production

前端 未结 18 1390
梦如初夏
梦如初夏 2020-11-29 15:15

I\'m trying to put my app into production and image and css asset paths aren\'t working.

Here\'s what I\'m currently doing:

  • Image assets live in /app/a
18条回答
  •  既然无缘
    2020-11-29 15:53

    I'm running Ubuntu Server 14.04, Ruby 2.2.1 and Rails 4.2.4 I have followed a deploy turorial from DigitalOcean and everything went well but when I go to the browser and enter the IP address of my VPS my app is loaded but without styles and javascript.

    The app is running with Unicorn and Nginx. To fix this problem I entered my server using SSH with my user 'deployer' and go to my app path which is '/home/deployer/apps/blog' and run the following command:

    RAILS_ENV=production bin/rake assets:precompile
    

    Then I just restart the VPS and that's it! It works for me!

    Hope it could be useful for somebody else!

提交回复
热议问题