You should instead use named URLs and the
django.core.urlresolvers.reverse function in your get_absolute_url
methods. That way you'll leave it to the URL system to handle. I
believe you shouldn't use absolute URLs (with http:// and domain) at
all. Just make sure in your web server config that all requests to
domain.com are redirected to www.domain.com while keeping the request
path (although I'd rather redirect from www.domain.com to domain.com
because it's cleaner and makes sense).
You should consult the docs about the URL system (reverse, permalink
and the {% url %} template tag).
Erik
On 22.09.2008, at 1:30, Catalyst wrote:
>
> I'm using Django .96 and I'm having trouble getting get_absolute_url
> to add a www. prefix on to my URLs.
>
> For the most part everything on my site keeps people on my www. URL,
> which is my goal, but my sitemap and RSS feeds point to URLs without a
> www. on them.
>
> Does anyone know a good way to fix this?
>
> Here's an example of how my get_absolute_url statement looks.
>
> def get_absolute_url(self):
> return "/appname/%s/%s/" % (self.creation_date.strftime("%Y/%b/
> %d").lower(), self.slug )
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---