[BUG #15978] subdomain caching - decision which idea is better

22 views
Skip to first unread message

Leszek Piątek

unread,
May 9, 2011, 6:54:43 PM5/9/11
to Django developers
There is a bug in django which leads to getting the same cache output
for different subdomains (but same PATH) - eg. pl.example.com/test/
and en.example.com/test/ . I've filled in BUG here:

http://code.djangoproject.com/ticket/15978

As aaugustin wrote, there are two ways of implementing:
- request.get_host():
+ simple, one line
- we get different cache for www. and w/o www. prefix
- using sites framework:
+ more django way - we are using contrib!
+ one line
+ we don't need to install sites framework - fallback to
RequestSite: http://docs.djangoproject.com/en/dev/ref/contrib/sites/?from=olddocs#requestsite-objects

Next thing to consider if such modification doesn't introduce any
nasty side-effects?

PS: For now I'm closer to second solution, and according to
documentation something like:
Site.objects.get_current().domain
will always get the domain even when we do not have sites installed.

Second solution weren't tested by me it's purely theoretical. Waiting
for comments!
Reply all
Reply to author
Forward
0 new messages