Saturday, April 18, 2015

Re: Possible bug with django site frameworks swapping between 2 sites every request

I wasn't suggesting that disabling caching was the fix, but just a way to start debugging the issue. Did it go away when you completely disabled the cache? Next step is to enable the cache again and progressively remove caching statements from your app till you find the culprit. For example:

1. Remove caching middleware. Still occurring?
2, Check and remove caching on your view methods/classes (assuming you've added some). Still occurring?
3. Examine your own non-view code for places you do manual caching. Still occurring?
4. Remove any caching blocks in your templates. Still occurring?
5. Once you have no places in your project where you've added caching then yes, it might be a bug in Django itself. 

On Sat, Apr 18, 2015 at 8:51 PM, Joe <joe@buffernet.com> wrote:
My question is this a bug?  I want to report it if so.  Even if disabling caching works, wouldn't still be considered a bug?

On Wednesday, April 15, 2015 at 7:04:47 AM UTC-7, Stephen Butler wrote:

On Wed, Apr 15, 2015 at 8:47 AM, Joe <j...@buffernet.com> wrote:
How do you set it to the dummy cache?

On Saturday, April 11, 2015 at 2:06:10 PM UTC-7, Stephen Butler wrote:
What happens if you disable all caching (try setting it to the dummy cache).

Also, you really shouldn't put your python code in your server's DocumentRoot. There's absolutely no reason to do it that way. You're just asking to have your settings.py file exposed by a misconfigured apache instance.

On Sat, Apr 11, 2015 at 10:02 AM, Joe <j...@buffernet.com> wrote:

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,allow  Allow from all  </Directory>    WSGIPythonPath /var/www/html/mysitedjango    <Directory /var/www/html/mysitedjango>  <Files wsgi.py>  Order deny,allow  Allow 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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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.

--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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/f9669c4c-de17-4b56-a6be-3db7a485e81d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f4bf2db4-2b92-430a-a873-21b02a0d23c7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAD4ANxV2Lcdscgsy4-3p05hiy13nednD4e0hts4Nn1_fiC3vgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment