Best way to run dev and production site concurrently on same server?

1 view
Skip to first unread message

Rob Hudson

unread,
May 18, 2006, 6:20:35 PM5/18/06
to Django users
I've recently completed a first milestone of a project and want to
publish it. I've got two URLs: www.mydomain.com and dev.mydomain.com.
I'm not too concerned if dev is public, I just don't want to break the
production website while I'm developing.

What's the best way to handle this?

Currently I only have the dev website -- the current production website
is static HTML.

I was thinking the dev site could have it's own path separate from the
production website. The dev website is checked out from subversion as
the trunk and the production is checked out from tags.

Based on my virtual hosts, can I have the production site list:
SetEnv DJANGO_SETTINGS_MODULE website.settings
and the dev site list:
SetEnv DJANGO_SETTINGS_MODULE website_dev.settings
and everything work?

Is there something more I need to consider? Is anyone else doing
something similar?

Thanks,
Rob

Luke Plant

unread,
May 20, 2006, 12:30:30 PM5/20/06
to django...@googlegroups.com
On Thursday 18 May 2006 23:20, Rob Hudson wrote:

> Based on my virtual hosts, can I have the production site list:
> SetEnv DJANGO_SETTINGS_MODULE website.settings
> and the dev site list:
> SetEnv DJANGO_SETTINGS_MODULE website_dev.settings
> and everything work?
>
> Is there something more I need to consider? Is anyone else doing
> something similar?

You may have to consider the 'Sites' objects. So far, I have only come
across these are used internally only for creating URLs in the RSS/Atom
framework. I think this can be taken care of by creating the necessary
Site objects and setting the SITE_ID option correctly in your settings
files. Other than that I can't see any problems.

Luke

--
Parenthetical remarks (however relevant) are unnecessary

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

Ian Holsman

unread,
May 20, 2006, 6:46:43 PM5/20/06
to django...@googlegroups.com
to use the Sites you may find the following useful.

class SiteLimitManager(models.Manager):
def get_query_set(self):
return super(SiteLimitManager, self).get_query_set().filter
(site=settings.SITE_ID)

and in your model add:
site = models.ForeignKey(Site, default=settings.SITE_ID,
blank=True)
objects = SiteLimitManager()

def save(self):
self.site = settings.SITE_ID
self.site_id = settings.SITE_ID
super(XXXMODELNAMEXXX, self).save()


this should make the production/dev thing pretty transparent to the
rest of your application, and allow you to share common things like
user-id's across both.

regards
Ian

> X-Google-Language: ENGLISH,UTF8
> Received: by 10.54.68.15 with SMTP id q15mr149925wra;
> Sat, 20 May 2006 09:31:04 -0700 (PDT)
> Return-Path: <L.Pla...@cantab.net>
> Received: from out3.smtp.messagingengine.com
> (out3.smtp.messagingengine.com [66.111.4.27])
> by mx.googlegroups.com with ESMTP id v11si417440cwb.
> 2006.05.20.09.31.02;
> Sat, 20 May 2006 09:31:04 -0700 (PDT)
> Received-SPF: neutral (googlegroups.com: 66.111.4.27 is neither
> permitted nor denied by best guess record for domain of L.Plant.
> 9...@cantab.net)
> Received: from frontend3.internal (frontend3.internal [10.202.2.152])
> by frontend1.messagingengine.com (Postfix) with ESMTP id 589FDD62E61
> for <django...@googlegroups.com>; Sat, 20 May 2006 12:31:01
> -0400 (EDT)
> Received: from heartbeat1.messagingengine.com ([10.202.2.160])
> by frontend3.internal (MEProxy); Sat, 20 May 2006 12:31:02 -0400
> X-Sasl-enc: TOvXyHl5eKU8anYn8+yXqXov7e647JzvglcJ1SItoDTP 1148142661
> Received: from calvin
> (host86-141-27-140.range86-141.btcentralplus.com [86.141.27.140])
> by mail.messagingengine.com (Postfix) with ESMTP id B0B15132E
> for <django...@googlegroups.com>; Sat, 20 May 2006 12:31:01
> -0400 (EDT)
> From: Luke Plant <L.Pla...@cantab.net>
> To: django...@googlegroups.com
> Subject: Re: Best way to run dev and production site concurrently
> on same server?
> Date: Sat, 20 May 2006 17:30:30 +0100
> User-Agent: KMail/1.8.3
> References: <1147990835.1...@u72g2000cwu.googlegroups.com>
> In-Reply-To: <1147990835.1...@u72g2000cwu.googlegroups.com>
> X-Face: "N27'AmvBWpdTowy8j|{(HM:g:In+;[nNrbEv6"_B>#oJW=()=?utf-8?q?
> g=2EtC=3BI9=7CDrpPnB=3Ff=242=5B9V=0A=09?="eYjDWVW
> [PFOJj5zbG1mZm>y3P^"$Fl)(=?utf-8?q?=3Fx=5E4/
> rPd4SMJX=7C53PpvkyMk=5F=5CmSl=24oK=25nZf3D=0A=09d=7EK+c?=
> =?utf-8?q?f=60wDl!q=27P4JNu=5FI=25V0!l=3D1D?="]WrI4&a7~ZZK!-|5T%<W
> Mime-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Message-Id: <200605201730.3...@cantab.net>

Ian Holsman

unread,
May 20, 2006, 6:50:03 PM5/20/06
to django...@googlegroups.com
oh.. you might also want to have a different pythoninterpreter
add the following to your virtual hosts.
PythonInterpreter xxx_prod
and
PythonInterpreter xxx_dev
Reply all
Reply to author
Forward
0 new messages