我如何告诉西纳特拉什么样的环境(开发,测试,生产)? [英] How do I tell Sinatra what environment (development, test, production) it is?
问题描述
(免责声明:在Heroku上部署Sinatra的新手。)
(Disclaimer: New to deploying Sinatra on Heroku.)
我曾见过 http://www.sinatrarb.com/configuration.html ,它告诉我 另外,即使在将该行 I have seen http://www.sinatrarb.com/configuration.html and it tells me to Gemfile Sinatra环境与正在加载的生产组内的宝石无关。这些是独立的,不能相互工作。 The Sinatra environment has nothing to do with the gems inside the production group being loaded. These are separate and don't work with each other. Sinatra从 Sinatra takes the environment from the 开始它,Bundler的工作方式有点不同,您可以选择它应该排除的组当运行bundle install时: Bundler works a bit different, you can choose which groups it should exclude when running bundle install: 这篇关于我如何告诉西纳特拉什么样的环境(开发,测试,生产)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
set:environment,:production
,我不认为它正在工作,因为当我尝试 rackup
时它仍然在运行(当我知道(或者我想我知道)它不应该是因为我没有在我的电脑上安装postgres)。set :environment, :production
. My question is, how can I specify it to do: "when in Heroku, set environment as production, else stay in test/development."Gemfile
推荐答案
RACK_ENV
环境变量中使用环境,只需从 RACK_ENV =生产rackup
RACK_ENV
environment variable, just start it with RACK_ENV=production rackup
bundle install --without production
bundle install --without production