# Dev and Prod URL

**URL:** <https://www.ruby-forum.com/t/dev-and-prod-url/65253>\
**Category:** Radiant CMS\
**Created:** [August 17, 2006, 1:25am UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253 "2006-08-17T01:25:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 17, 2006, 1:25am UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/1 "2006-08-17T01:25:27Z")

</div>

Hello,

How do you access the dev/prod URL referenced in the Radiant feature  
list?

“Operates in two modes: dev and production depending on the URL”

Thanks,

Bryan

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 17, 2006, 3:46am UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/2 "2006-08-17T03:46:27Z")

</div>

Bryan wrote:

> How do you access the dev/prod URL referenced in the Radiant feature  
> list?

Alias the domain name so that your web server serves the same site from  
different URLs. So:

[http://mysite.com](http://mysite.com)

Is the production URL and:

[http://dev.mysite.com](http://dev.mysite.com)

Is the dev URL. If you’d like to use a different domain name for your  
dev site, set it up in the config:

% script/console production  
Loading production environment.

> > Radiant::Config[‘dev.host’] = ‘[preview.mysite.com](http://preview.mysite.com)’  
> > =\> “[preview.mysite.com](http://preview.mysite.com)”

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 18, 2006, 1:19am UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/3 "2006-08-18T01:19:17Z")

</div>

Hi,

The dev and prod url feature is great. I had it working briefly until I  
changed some settings in a lighttpd.conf file. Now it redirects  
everything to dev.

Could you recommend a way to use it with a redirect like this?

(implemented to redirect domain to www.domain).

$HTTP[“host”] =~ “^ushousingreport.com$” {  
url.redirect = (  
“^/(.\*)” =\> “[http://www.ushousingreport.com/$1](http://www.ushousingreport.com/$1)”,  
“” =\> “[http://www.ushousingreport.com/](http://www.ushousingreport.com/)”  
)  
}

Maybe an exception rule to the redirect for [dev.ushousingreport.com](http://dev.ushousingreport.com)?

Thanks,

Bryan

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 22, 2006, 5:20pm UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/4 "2006-08-22T17:20:37Z")

</div>

As far as documentation goes, it isn’t readily apparent how to set up  
the development sub-domain when going through the README file. I know  
it’s not Radiant specific, but it might help to explain it a little  
more.

A symlink seemed to be the way to point the [dev.domain.com](http://dev.domain.com) to  
[domain.com](http://domain.com).

That’s basically the only step right?

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 18, 2006, 4:49am UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/5 "2006-08-18T04:49:22Z")

</div>

Bryan wrote:

> Maybe an exception rule to the redirect for [dev.ushousingreport.com](http://dev.ushousingreport.com)?

I believe you could do:

$HTTP[“host”] =~ “ushousingreport.com$” {  
$HTTP[“host”] !~ “^(dev|www)” {  
url.redirect = (  
“^/(.\*)” =\> “[http://www.ushousingreport.com/$1](http://www.ushousingreport.com/$1)”,  
“” =\> “[http://www.ushousingreport.com/](http://www.ushousingreport.com/)”  
)  
}  
}

Is that what you mean?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 22, 2006, 5:42pm UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/6 "2006-08-22T17:42:41Z")

</div>

Erik M. wrote:

> As far as documentation goes, it isn’t readily apparent how to set up  
> the development sub-domain when going through the README file. I know  
> it’s not Radiant specific, but it might help to explain it a little more.
> 
> A symlink seemed to be the way to point the [dev.domain.com](http://dev.domain.com) to [domain.com](http://domain.com).
> 
> That’s basically the only step right?

Yes. But you can do it a number of ways (symlink, dns, etc…). The key  
thing is that Radiant uses the ‘host’ header to determine whether it is  
in dev or live mode. Line 47 of site\_controller.rb shows the logic:

(@request.host == @config[‘dev.host’]) or (@request.host =~ /^dev/)

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 22, 2006, 11:27pm UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/7 "2006-08-22T23:27:56Z")

</div>

Bryan wrote:

> Could you explain the difference between dev and prod modes as  
> implemented in Radiant? Does the URL change force Radiant code to run  
> in dev/prod or does it simply access different Databases using the prod  
> code.
> 
> I am trying to figure the best workflow for handling changes to design  
> and content.

dev and live mode in Radiant are different than development and  
production environments in Rails (they have nothing to do with the  
database). You can run in both dev and live mode regardless of the  
environment you are running on. The difference between the modes is that  
in dev mode you can see pages that are marked as draft, but in live mode  
you cannot.

Larry M. told me that instead of using the dev and live modes he just  
runs two versions of the site. One on the production Web site, and one  
on his local computer. He uses sqlite for the db, and when he is ready  
to go live he just copies the new database file over to the server. This  
might be a good workflow solution.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 22, 2006, 11:10pm UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/8 "2006-08-22T23:10:17Z")

</div>

Hello,

Could you explain the difference between dev and prod modes as  
implemented in Radiant? Does the URL change force Radiant code to run  
in dev/prod or does it simply access different Databases using the prod  
code.

I am trying to figure the best workflow for handling changes to design  
and content.

Thanks,

Bryan

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 23, 2006, 12:32am UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/9 "2006-08-23T00:32:06Z")

</div>

Bryan wrote:

> Does Radiant still access the prod database when using the dev url in  
> production mode. I am trying to determine if I could get by using only  
> one DB because my host limits DBs. I probably won’t be developing or  
> testing code.

Yes. Radiant still uses the production database.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![bryan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/db5fbb/32.png) [@bryan](https://www.ruby-forum.com/u/bryan)\
**Post date:** [August 22, 2006, 11:44pm UTC](https://www.ruby-forum.com/t/dev-and-prod-url/65253/10 "2006-08-22T23:44:24Z")

</div>

John W. Long wrote:

> Bryan wrote:
> 
> > Could you explain the difference between dev and prod modes as  
> > implemented in Radiant? Does the URL change force Radiant code to run  
> > in dev/prod or does it simply access different Databases using the prod  
> > code.
> > 
> > I am trying to figure the best workflow for handling changes to design  
> > and content.
> 
> dev and live mode in Radiant are different than development and  
> production environments in Rails (they have nothing to do with the  
> database). You can run in both dev and live mode regardless of the  
> environment you are running on. The difference between the modes is that  
> in dev mode you can see pages that are marked as draft, but in live mode  
> you cannot.

Does Radiant still access the prod database when using the dev url in  
production mode. I am trying to determine if I could get by using only  
one DB because my host limits DBs. I probably won’t be developing or  
testing code.

Thanks again,

Bryan

> Larry M. told me that instead of using the dev and live modes he just  
> runs two versions of the site. One on the production Web site, and one  
> on his local computer. He uses sqlite for the db, and when he is ready  
> to go live he just copies the new database file over to the server. This  
> might be a good workflow solution.
> 
> –  
> John L.  
> [http://wiseheartdesign.com](http://wiseheartdesign.com)
