Heroku always runs assets:precompile with the production environment for Rails 3.2

倾然丶 夕夏残阳落幕 提交于 2019-12-09 05:34:50

问题


I have my Heroku environment set to staging but my assets are always compiled in the production environment.

Here's heroku config:

GEM_PATH            => vendor/bundle/ruby/1.9.1
LANG                => en_US.UTF-8
PATH                => bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
RACK_ENV            => staging

I've added an exception to the production.rb file so I know which env it's running when compiling the assets. The server starts up just fine running heroku run console shows that I'm running staging.

It's just when running assets:precompile that it's always in production.

I'd be happy to post any other config file if required.

I can add that I'm running Rails 3.2.2 and the Cedar stack on heroku


Output from heroku run rake about:

About your application's environment
Ruby version             1.9.2 (x86_64-linux)
RubyGems version         1.3.7
Rack version             1.4
Rails version            3.2.2
JavaScript Runtime       therubyracer (V8)
Action Pack version      3.2.2
Active Support version   3.2.2
Middleware               Rack::Cache, ActionDispatch::Static, Rack::Lock, #, Rack::Runtime, Rack::Auth::Basic, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport
Application root         /app
Environment              staging

And running heroku run rake assets:precompile gives:

/usr/local/bin/ruby /app/vendor/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets

Should I just give up and email Heroku?


回答1:


Apparently I needed to enable a plugin to make it work.




回答2:


Try setting RAILS_ENV to staging as well and see if that makes Heroku any happier.



来源:https://stackoverflow.com/questions/9830244/heroku-always-runs-assetsprecompile-with-the-production-environment-for-rails-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!