gpt4 book ai didi

heroku - 为 Rails 4 应用程序加速 Heroku 部署

转载 作者:行者123 更新时间:2023-12-04 12:58:57 24 4
gpt4 key购买 nike

有没有办法在 Heroku 上缓存 Rails 4 应用程序的预编译 Assets ?

我按照 this blog post 的说明进行操作和一些 heroku 文档,它们大大加快了速度,但仍然需要同样长的时间来预编译 Assets 。

这是我的 gemfile 中的相关部分(也发现 enable the 'user-env-compile' lab 有必要):

group :production, :staging do
# for heroku, see https://devcenter.heroku.com/articles/rails-integration-gems
gem 'rails_12factor'

# https://devcenter.heroku.com/articles/rack-cache-memcached-rails31
gem 'rack-cache'
gem 'kgio'

# faster heroku deploys (http://blog.alexmaccaw.com/faster-deploys)
gem 'memcachier'
gem 'dalli'
end

从我的 config/production.rb 和 config/staging.rb :
  # Neither of the below worked (tried separately)
# config.assets.cache_store = :dalli_store
config.assets.configure {|env| env.cache = ActiveSupport::Cache.lookup_store(:dalli_store) }

谢谢!

最佳答案

看看 assets_sync gem。

关于heroku - 为 Rails 4 应用程序加速 Heroku 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18178271/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com