在Sinatra中,生产环境和开发环境有什么区别?

gbe*_*ous 5 ruby development-environment production-environment sinatra

我找不到详尽的答案。

如果我设置“生产”会发生什么?我看到视图文件不再“即时”读取,但是还有其他区别吗?

gcs*_*str 2

基本上,只有模板会受到环境变量的影响。

您可以根据当前环境自由实现其他所有应用程序逻辑方法:

  if settings.production?
    # this will only run in production
  else
    # every other env
  end
Run Code Online (Sandbox Code Playgroud)

当需要条件配置时,您也可以执行类似的操作:

configure :production, :development do
  enable :logging
end
Run Code Online (Sandbox Code Playgroud)