【发布时间】:2016-01-20 04:28:14
【问题描述】:
昨天我尝试将我的 rails 应用程序部署到我自己的服务器上。对于部署,我遵循 gorails 教程 -> https://gorails.com/deploy/ubuntu/14.04。部署后,我的 Rails 应用程序终于可以实时运行了。但是当我尝试使用图像创建房间模块时遇到问题,我收到这样的错误
We're sorry, but something went wrong.
如果我创建没有图像的房间,它会成功。我确定我不能上传图片。
gem 'paperclip'
房间.rb
has_attached_file :image, :styles => { :for_index => "336x227>", :thumb => "150x150>" }, :default_url => "/images/:style/missing.png"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
部署.rb
lock '3.1.0'
set :application, 'hotelxxxxx'
set :repo_url, 'git@bitbucket.org:xxxxxx/hotelxxxxx.git'
set :deploy_to, '/home/xxxxxx/hotelxxxxx'
set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute :touch, release_path.join('tmp/restart.txt')
end
end
after :publishing, 'deploy:restart'
after :finishing, 'deploy:cleanup'
end
如何解决?
【问题讨论】:
标签: ruby-on-rails-4 nginx passenger capistrano3