Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Sept. 6, 2005 22:59:40

[EMAIL P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Multiple Sites under One Database


Is there support for running multiple sites under a single database?

Thanks,

A.

Offline

#2 Sept. 7, 2005 00:59:14

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Multiple Sites under One Database


On 9/6/05, <> wrote:
> Is there support for running multiple sites under a single database?

Yes. Just use the same DATABASE_NAME setting in multiple Django instances.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Sept. 7, 2005 18:40:50

[EMAIL P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Multiple Sites under One Database


Ok, and this means everything will be completely shared. Will the
"site" part of the flatfiles function as I would guess?

Thanks!

A.

Offline

#4 Sept. 7, 2005 19:35:14

Jacob K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Multiple Sites under One Database


On Sep 7, 2005, at 12:40 PM, wrote:Ok, and this means everything will be completely shared. Will the
"site" part of the flatfiles function as I would guess?Exactly.Add a site object (has to be done manually in the DB right now) andthen set the site for the flat page. Also, anywhere you want non-globally-shared content, add a relation to core.Site to the objectand check in the view that the object exists in the current site.The "right" way to do this is to set SITE_ID in your individualDjango config file and check against that.For example, let's say you have two sites, www.example.com andwww2.example.com. In you www.py settings file, you'd have "SITE_ID =1" and in your www2.py settings "SITE_ID = 2". Then a "storiesindex" view could look like:from django.conf.settings import SITE_ID
from django.models.stories import stories

def stories_index(request):
story_list = stories.get_list(site__pk=SITE_ID)
# do something with story list...Your view will automatically pick up the right site through theDJANGO_SETTINGS_MODULE mechanism, and your stories won't be shared.Clear as mud?

Jacob

Offline

#5 Sept. 8, 2005 15:01:05

[EMAIL P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Multiple Sites under One Database


That's great. So, the views don't, by default, consider SITE_ID then.

Thanks much,

A.

Offline

#6 Aug. 19, 2017 08:38:57

Moisesfew
Registered: 2017-03-16
Posts: 2
Reputation: +  0  -
Profile   Send e-mail  

Multiple Sites under One Database

This post is being moderated

Offline

Board footer

Moderator control

Enjoy the 21st of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support