On Dec 8, 3:23 am, Rick Yazwinski <rick.yazwin...@gmail.com> wrote: > I think that this may be too simplified: > protocol = getattr(settings, "PROTOCOL", "http") > domain = Site.objects.get_current().domain > port = getattr(settings, "PORT", "") > > Many sites put load balancers and https hardward acceleration in front > of their web interfaces. This would obscure the protocol and port > info from Django.
Aha! I was pretty confused by this thread, since I didn't remember writing the above code. It turns out that's the problem with making proposals like this on a wiki... http://code.djangoproject.com/wiki/ReplacingGetAbsoluteUrl?action=diff&version=10 My original proposal can still be seen here: http://code.google.com/p/django-urls/source/browse/trunk/django_urls/base.py It's basically this: def get_url(self): if hasattr(self.get_url_path, 'dont_recurse'): raise NotImplemented try: path = self.get_url_path() except NotImplemented: raise prefix = getattr(settings, 'DEFAULT_URL_PREFIX', 'http:// localhost') return prefix + path get_url.dont_recurse = True So for the common case it invents a new DEFAULT_URL_PREFIX setting which can be used to ensure get_url uses the correct domain. If you want to use a threadlocal request for this instead that's fine - just define your own get_url() method that does that. Cheers, Simon -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.