heroku上的Rails5忘记了用回形针和涡轮链接存储的文件:没有路由匹配



我有一个博客,通过回形针5.1.0和涡轮链接5.0.1上传/下载文件。没有验证的上传现在可以正常工作,但下载只在上传后的短时间内有效。之后显示错误(404):

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数据库进行生产。当我不通过heroku部署时:那么本地副本与ruby 2.2.4版本配合得很好!

带有git push heroku master的heroku上的新部署不会修复附件链接。

只有手动删除数据库文件和新的上传才能使附件链接在短时间内重新工作。

第页。S.当dyno被重新启动时,例如使用heroku restart,则文件系统是新的并被删除。但我不知道,如何使用redis或amazonaws3使文件系统持久化!

日志上写着:

2017-01-31T12:21:03.027810+000:00 heroku[路由器]:at=info method=GET path="/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar"host=infinite-aiga-25466.herokuapp.com request_id=fb775bcc-64f4-d6b-89c0-70991af31e2f fwd="178.15.12.47"dyno=web.1 connect=0ms service=2ms status=404字节=17442017-01-31T12:21:03.026812+00:00 app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]开始GET"/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar"在2017-01-31 12:21:03+00002017-01-31T12:21:03.027262+00:00应用程序[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]2017-01-31T12:21:03.027284+000:00-app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]操作控制器::RoutingError(没有路由匹配[GET]"/system/articles/attachments/000/000/015/original/gmr-1.8.3.jar"):2017-01-31T12:21:03.027302+00:00应用程序[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]2017-01-31T12:21:03.027334+00:00 app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/mediadleware/debug_exceptions.rb:53:在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调用中'2017-01-31T12:21:03.027337+000:00 app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/railties-5.0.1/lib/rrails/rack/logger.rb:36:在调用中的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-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/tagged_logging.rb:26:intagged' 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-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/activesupport-5.0.1/lib/active_support/taged_logging.rb:69:intagged' 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-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/middleware/request_id.rb:24:在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调用中'2017-01-31T12:21:03.027343+000:00 app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/rack-2.01/lib/rrack/runtime.rb:22:incall' 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-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/actionpack-5.0.1/lib/action_dispatch/medialeware/axecutor.rb:12:在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调用中'2017-01-31T12:21:03.027346+000:00 app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/rack-2.01/lib/rrack/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-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/puma-3.70/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:inprocess_client'2017-01-31T12:21:03.027350+00:00 app[web.1]:[fb775bcc-64f4-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/puma-3.70/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-d6b-89c0-70991af31e2f]vendor/bundle/ruby/2.2.0/gems/puma-3.70/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中调用

C: \站点\博客_产品_ heroku>

这是根本原因:当dyno定期重新启动或使用heroku restart时,文件系统将初始化并新建。

我仍在努力将AmazonS3持久性添加到我的应用程序中。。。

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

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

最新更新