heroku上的Rails 5会忘记使用回形针和Turbolinks存储的文件:没有路线匹配 [英] Rails 5 on heroku forgets files stored with paperclip and turbolinks: No route matches

查看:150
本文介绍了heroku上的Rails 5会忘记使用回形针和Turbolinks存储的文件:没有路线匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个博客,该文件可以通过回形针5.1.0和turbolink 5.0.1进行上传/下载.未经验证的上传现在可以正常工作,但是下载仅在上传后的短时间内起作用.然后显示错误(404):

I have a blog with file up-/download via paperclip 5.1.0 and turbolinks 5.0.1. Upload without validation works fine now, but download is only working for a short period after upload. Afterwards an error (404) is displayed:

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

If you are the application owner check the logs for more information.

这没有帮助:

heroku rake db:migrate
heroku restart

我正在使用Heroku上的mysql DB进行生产.当我不通过heroku进行部署时:本地副本在ruby 2.2.4版本中可以正常工作!

I am on production with mysql DB on heroku. When I am not deploying via heroku: then the local copy works just fine with ruby version 2.2.4!

在Heroku上使用git push heroku master进行的新部署无法修复附件链接.

New deployment on heroku with git push heroku master does not fix the attachment links.

只有手动删除数据库文件和新上载才能使附件链接在短时间内再次工作.

Only manual deletion of DB files and new upload makes attachment links work again for a short period of time.

P. S.当重新启动测功机时,e. G.如果使用heroku restart,则文件系统是新的并已删除.但是我不知道,如何使用redis或amazon aws s3使文件系统持久化!

P. S. When the dyno is restartet, e. g. with heroku restart, then the filesystem is new and deleted. But I do not know, how to make filesystem persistent with redis or amazon aws s3!

日志显示:

2017-01-31T12:21:03.027810 + 00:00 heroku [router]:at = info method = GET path ="/system/articles/attachments/000/000/015/original/gmr-1.8.3 .jar"host = infinite-taiga-25466.herokuapp.com request_id = fb775bcc-64f4-4d6b-89c0-70991af31e2f fwd =" 178.15.12.47"dyno = web.1 connect = 0ms service = 2ms status = 404 bytes = 1744 2017-01-31T12:21:03.026812 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f]开始GET"/system/articles/attachments/000/000/015/original/gmr -1.8.3.jar",用于2017年1月31日12:21:03 +0000的178.15.12.47 2017-01-31T12:21:03.027262 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] 2017-01-31T12:21:03.027284 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] ActionController :: RoutingError(没有与[GET]匹配的路由"/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar"): 2017-01-31T12:21:03.027302 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] 2017-01-31T12:21:03.027334 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/actionpack-5.0.1/lib /action_dispatch/middleware/debug_exceptions.rb:53:in call' 2017-01-31T12:21:03.027336+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in call' 2017-01-31T12:21:03.027337 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/railties-5.0.1/lib /rails/rack/logger.rb:36:in call_app' 2017-01-31T12:21:03.027338+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:in阻止通话中' 2017-01-31T12:21:03.027339 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/activesupport-5.0.1/lib /active_support/tagged_logging.rb:26:在tagged' 2017-01-31T12:21:03.027338+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:in中标记为' 2017-01-31T12:21:03.027340 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/activesupport-5.0.1/lib /active_support/tagged_logging.rb:69:在tagged' 2017-01-31T12:21:03.027341+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:in通话中 2017-01-31T12:21:03.027341 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/actionpack-5.0.1/lib /action_dispatch/middleware/request_id.rb:24:in call' 2017-01-31T12:21:03.027342+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in call' 2017-01-31T12:21:03.027343 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/rack-2.0.1/lib /rack/runtime.rb:22:in call' 2017-01-31T12:21:03.027344+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call' 2017-01-31T12:21:03.027345 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/actionpack-5.0.1/lib /action_dispatch/middleware/executor.rb:12:in call' 2017-01-31T12:21:03.027346+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/static.rb:136:in call' 2017-01-31T12:21:03.027346 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/rack-2.0.1/lib /rack/sendfile.rb:111:在call' 2017-01-31T12:21:03.027347+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:522:in调用中 2017-01-31T12:21:03.027349 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/puma-3.7.0/lib /puma/server.rb:578:在handle_request' 2017-01-31T12:21:03.027349+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:415:in process_client'中 2017-01-31T12:21:03.027350 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/puma-3.7.0/lib /puma/server.rb:275:在block in run' 2017-01-31T12:21:03.027351+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in通话中 2017-01-31T12:21:03.027352 + 00:00 app [web.1]:[fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby​​/2.2.0/gems/puma-3.7.0/lib /puma/thread_pool.rb:120:在block in spawn_thread' 2017-01-31T12:21:03.027348+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/configuration.rb:226:in通话中

2017-01-31T12:21:03.027810+00:00 heroku[router]: at=info method=GET path="/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar" host=infinite-taiga-25466.herokuapp.com request_id=fb775bcc-64f4-4d6b-89c0-70991af31e2f fwd="178.15.12.47" dyno=web.1 connect=0ms service=2ms status=404 bytes=1744 2017-01-31T12:21:03.026812+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] Started GET "/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar" for 178.15.12.47 at 2017-01-31 12:21:03 +0000 2017-01-31T12:21:03.027262+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] 2017-01-31T12:21:03.027284+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] ActionController::RoutingError (No route matches [GET] "/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar"): 2017-01-31T12:21:03.027302+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] 2017-01-31T12:21:03.027334+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/debug_exceptions.rb:53:in call' 2017-01-31T12:21:03.027336+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/show_exceptions.rb:31:incall' 2017-01-31T12:21:03.027337+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:36:in call_app' 2017-01-31T12:21:03.027338+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:inblock in call' 2017-01-31T12:21:03.027339+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:26:in tagged' 2017-01-31T12:21:03.027338+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:inblock in tagged' 2017-01-31T12:21:03.027340+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:69:in tagged' 2017-01-31T12:21:03.027341+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/rack/logger.rb:24:incall' 2017-01-31T12:21:03.027341+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/request_id.rb:24:in call' 2017-01-31T12:21:03.027342+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:incall' 2017-01-31T12:21:03.027343+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in call' 2017-01-31T12:21:03.027344+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/cache/strategy/local_cache_middleware.rb:28:incall' 2017-01-31T12:21:03.027345+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/executor.rb:12:in call' 2017-01-31T12:21:03.027346+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/static.rb:136:incall' 2017-01-31T12:21:03.027346+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in call' 2017-01-31T12:21:03.027347+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rails/engine.rb:522:incall' 2017-01-31T12:21:03.027349+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:578:in handle_request' 2017-01-31T12:21:03.027349+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:415:inprocess_client' 2017-01-31T12:21:03.027350+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/server.rb:275:in block in run' 2017-01-31T12:21:03.027351+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:incall' 2017-01-31T12:21:03.027352+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/thread_pool.rb:120:in block in spawn_thread' 2017-01-31T12:21:03.027348+00:00 app[web.1]: [fb775bcc-64f4-4d6b-89c0-70991af31e2f] vendor/bundle/ruby/2.2.0/gems/puma-3.7.0/lib/puma/configuration.rb:226:incall'

C:\ Sites \ blog_production_heroku>

C:\Sites\blog_production_heroku>

推荐答案

新的git版本的回形针gem现在可以与aws-sdk-s3 gem一起使用,并将其添加到Gemfile中:

New git version of paperclip gem now works with aws-sdk-s3 gem, add this to Gemfile:

#Paperclip
gem 'paperclip', git: 'git://github.com/thoughtbot/paperclip.git'

这篇关于heroku上的Rails 5会忘记使用回形针和Turbolinks存储的文件:没有路线匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆