On Wed, 2007-04-25 at 10:32 +0000, Matt wrote:
> Hi everyone,
> 
> I have a quick question about the new LOGIN_URL, LOGOUT_URL, and
> LOGIN_REDIRECT_URL settings.  If, in my project's settings module, I
> write:
> 
>     LOGIN_URL = '/blah/'
>     LOGOUT_URL = '/blah/blah/'
>     LOGIN_REDIRECT_URL = '/blah/blah/blah/'
> 
> They work just fine.  But I want to remove hard-coded URLs from my
> code; so I write:
> 
>     from django.core.urlresolvers import reverse
>     LOGIN_URL = reverse('django.contrib.auth.views.login')
>     LOGOUT_URL = reverse('django.contrib.auth.views.logout')
>     LOGIN_REDIRECT_URL = reverse('gigall.apps.accounts.views.profile')
> 
> This fails; the URLs used are Django's defaults.
> 
> Does anyone know why this is so?  And can I work around it?

I have doubts that using reverse() in the settings file is going to
work. It relies on the value of ROOT_URLCONF, which will only be
available once the settings module has been fully imported. So trying to
access that value *whilst* settings is being imported looks like it's
doomed to failure.

There are some cases where you're just going to need to put strings for
URLs. Feel free to come up with a fix, though.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to