On 1 oct, 21:57, John Allen <[EMAIL PROTECTED]> wrote: > My experimental Django site is has URLs like > > http://allenlux.dyndns.org/cms/weblog/2008/aug/23/website-now-using-r... > > where everything lives under the folder /cms/ ie the Apache > configuration looks like > > <Location "/cms/"> > SetHandler python-program > PythonHandler django.core.handlers.modpython > SetEnv DJANGO_SETTINGS_MODULE cms.settings > PythonOption django.root /cms > PythonDebug On > PythonPath "['/home/usr/django-code/', '/usr/lib/python2.5/site- > packages/django/'] + sys.path" > </Location> > > Within the application I'm trying to construct real complete URLs by > concatenating Site.objects.get_current().domain and get_absolute_url() > for the page object. > > This works fine under some circumstances eg from the Python shell: > ...>>> Site.objects.get_current().domain > > u'allenlux.dyndns.org/cms' > ...>>> page[1].get_absolute_url() > > '/weblog/2008/aug/23/website-now-using-radiant/' > ...>>> Site.objects.get_current().domain+page[1].get_absolute_url() > > u'allenlux.dyndns.org/cms/weblog/2008/aug/23/website-now-using- > radiant/' > > > > But when I use the exact same expression in a custom tag, it gives > thishttp://allenlux.dyndns.org/cms/cms/weblog/2008/aug/23/website-now-usi... > > ie the get_absolute_url() seems to be returning the /cms/ part as > well.
I think this has to do with '/cms/' being defined in both your domain name and your apache conf's location directive. Since you tell Django the django.root is /cms/, it must add it to build an effectively *absolute* url - that is, one starting at the root of your domain. And since you have this /cms/ in your sites.domain (which fwiw shouldn't be the case - not a valid *domain* name), you end up having this url path portion twice. IOW, you shouldn't have /cms/ in your sites.domain. While we're at it : what's your use case for adding the domain name to the url ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---