I am using django's sites framework with dajngo 1.7. I am calling the site
name through a context processor like below. The problem is that every time
the page loads, it switches between site1 and site2:
def site_info(request):
Site.objects.clear_cache()# i tried with and without this
site = get_current_site(request)
site_detail = SiteDetail.objects.get(site_id=site.id)
return {
'site_domain': site.domain,
'site_name': site.name,
'site_short_name': site_detail.short_name,
}
In my template I simply refer to the site name to do some logic and it
switches back and forth between 2 of my sites on every request:
{% if site_name = 'Site 1' %}
<img src="{% static 'img/site1-logo.png' %}" alt="">
{% elif site_name = 'Site 2' %}
<img src="{% static 'img/site2-logo.png' %}" alt="">
{% endif %}
My httpd.conf looks like this:
<VirtualHost *:80>
ServerName mysite1.com
DocumentRoot /var/www/html/mysitedjango
WSGIScriptAlias /
/var/www/html/mysitedjango/mysite1/mysite1_wsgi.py</VirtualHost>
<VirtualHost *:80>
ServerName mysite2.com
DocumentRoot /var/www/html/mysitedjango
WSGIScriptAlias /
/var/www/html/mysitedjango/mysite1/mysite2_wsgi.py</VirtualHost>
Alias /static/ /var/www/html/mysitedjango/shared/static/
<Directory /var/www/html/mysitedjango/shared/static/>Order deny,allowAllow from
all</Directory>
WSGIPythonPath /var/www/html/mysitedjango
<Directory /var/www/html/mysitedjango><Files wsgi.py>Order deny,allowAllow from
all</Files></Directory>
Is this a bug? How can I stop swapping and make each site completely
sandboxed?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/70ef019a-09a0-408c-9118-12f94fb2d157%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.