On 28/08/2013 9:08am, Mike Dewhirst wrote:
On 28/08/2013 4:01am, Gerd Koetje wrote:
Hi all,

I got a django application that is called by difrant domains for the
same code (some minor changes for each domain)


When i visit my application trough domain1.com or domain2.com its keep
outputting data from the set site_id in settings
How can i change the site_id based on the incomming domain


so if i visit trough domain1.com it should set the site_id to  the id of
domein1.com in the database , not the set site_id in settings.


How do i do this?

You need to have all the various domains listed in the sites table and
after importing Site from django.contrib.sites.models you can return
Site.objects.get_current() for use in your responses.

I only have three sites dev, staging and production and use settings.py
on the three machines to set the site. You will need to detect which
site is making the the request and establish the site_id from there.

I know what I meant despite what I said. You will have to detect the domain from the url in the request and get the site_id from that then pass that in so your response uses the correct domain.


hth


--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.



--

Climate Pty Ltd
PO Box 308
Mount Eliza
Vic 3930
Australia +61

T: 03 9787 6598
M: 0411 704 143


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to