# Switching from development to production?

**URL:** <https://www.ruby-forum.com/t/switching-from-development-to-production/60322>\
**Category:** Rails\
**Created:** [May 12, 2006, 3:31am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322 "2006-05-12T03:31:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 12, 2006, 3:31am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/1 "2006-05-12T03:31:32Z")

</div>

I think I’m missing a step here, but they don’t seem to cover this in  
the AWDWR book… does anybody know the various steps required to switch  
from development to production mode in Rails? I’ve scoured the  
application and changed everything that stands out, but the damn thing  
is still running off the development database and won’t connect to the  
production one. Or more accurately, since the production database is  
empty, it won’t “break” for me.

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 12, 2006, 9:27am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/2 "2006-05-12T09:27:31Z")

</div>

sean colquhoun wrote:

> I think I’m missing a step here, but they don’t seem to cover this in  
> the AWDWR book… does anybody know the various steps required to switch  
> from development to production mode in Rails? I’ve scoured the  
> application and changed everything that stands out, but the damn thing  
> is still running off the development database and won’t connect to the  
> production one. Or more accurately, since the production database is  
> empty, it won’t “break” for me.

this is in environment.rb:

# Uncomment below to force Rails into production mode when

# you don’t control web/app server and can’t set it the proper way

# ENV[‘RAILS\_ENV’] ||= ‘production’

but I don’t think that’s the proper way. I’m pretty sure it’s just a  
setting in a config file somewhere like this though.

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 12, 2006, 9:35am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/3 "2006-05-12T09:35:38Z")

</div>

> this is in environment.rb:
> 
> # Uncomment below to force Rails into production mode when
> 
> # you don’t control web/app server and can’t set it the proper way
> 
> # ENV[‘RAILS\_ENV’] ||= ‘production’
> 
> but I don’t think that’s the proper way. I’m pretty sure it’s just a  
> setting in a config file somewhere like this though.

Yeah, see that’s the strange part. I did that, and it’s still working. I  
don’t think I’ve set it properly. There wouldn’t be anyone around who  
happens to know the “proper” way, would there?

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 12, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/4 "2006-05-12T18:08:02Z")

</div>

sean colquhoun wrote:

> Yeah, see that’s the strange part. I did that, and it’s still working. I  
> don’t think I’ve set it properly. There wouldn’t be anyone around who  
> happens to know the “proper” way, would there?

Did you restart your server after changing the configuration? The  
environment is only read on start up.

script/server -e production

–

Ray

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 12, 2006, 5:27pm UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/5 "2006-05-12T17:27:08Z")

</div>

What OS are you running on? Do you have an environment variable  
RAILS\_ENV set?

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 15, 2006, 6:33am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/6 "2006-05-15T06:33:12Z")

</div>

I beleive the built in web server in rails works differently than when  
you deploy on Apache.

On 5/14/06, sean colquhoun [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 15, 2006, 6:39am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/7 "2006-05-15T06:39:22Z")

</div>

JÃ³n BorgÃ¾Ã³rsson wrote:

> I beleive the built in web server in rails works differently than when  
> you deploy on Apache.

Good point. Would there be an equivalent necessary step when setting it  
up on Apache?

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 15, 2006, 5:09am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/8 "2006-05-15T05:09:50Z")

</div>

Ray B. wrote:

> sean colquhoun wrote:
> 
> > Yeah, see that’s the strange part. I did that, and it’s still working. I  
> > don’t think I’ve set it properly. There wouldn’t be anyone around who  
> > happens to know the “proper” way, would there?
> 
> Did you restart your server after changing the configuration? The  
> environment is only read on start up.
> 
> script/server -e production
> 
> –
> 
> Ray

Holy s\*\*t. It worked! What does “script/server -e production” do? I was  
just using script/server as always. I didn’t know you had to specify  
anything in the command line to set it as well.

---

<div class="post-metadata">

**Author:** ![smc7000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@smc7000](https://www.ruby-forum.com/u/smc7000)\
**Post date:** [May 17, 2006, 12:16am UTC](https://www.ruby-forum.com/t/switching-from-development-to-production/60322/9 "2006-05-17T00:16:18Z")

</div>

Nobb… When using Apache then the enviroment.rb step you did should  
work,

On 5/15/06, sean colquhoun [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–
