The problem is that reverse works by querying the structure that is defined
by importing the urls modules.

A possible cheap trick is to create your dictionary in a module global,
passing that to the url call, in which case you could later import the
module and patch the "post_reset_redirect' item with data that you could
then get from reverse.

But, IIRC, urls may not be imported until the first request, so it may be
tricky finding a place to put this code.

Bill


On Tue, Oct 8, 2013 at 11:11 AM, DJ-Tom <[email protected]> wrote:

> Based on this 
> article<http://garmoncheg.blogspot.com.au/2012/07/django-resetting-passwords-with.html>I
>  implemented a password reset function.
>
> Unfortunately, currently this only works on the development server because
> the base URLs for the post_reset_redirect are different on the production
> server.
>
> This is the relevant part of my urls.py, I marked the prolematic parts in
> red:
>
>     
> url(r'^password/reset/$','django.contrib.auth.views.password_reset',{'post_reset_redirect'
> : '/accounts/password/reset/done/', 'template_name':
> 'accounts/password_reset.html'}, name="password_reset"),\
>
> (r'^password/reset/done/$','django.contrib.auth.views.password_reset_done',{'template_name':
> 'accounts/password_reset_done.html'}), \
>
> (r'^password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$','django.contrib.auth.views.password_reset_confirm',{'post_reset_redirect'
> : '/accounts/password/done/', 'template_name':
> 'accounts/password_reset_confirm.html'}),\
>     (r'^password/done/$',
> 'django.contrib.auth.views.password_reset_complete',{'template_name':
> 'accounts/password_reset_complete.html'}),
> )
>
> Normally I would use
> reverse('django.contrib.auth.views.password_reset_done') to get the correct
> URL, but using reverse() inside the urls.py leads to a configuration error,
> so how can I put the correct URLs here so it works correct both in
> development and production?
>
> Thanks
> Thomas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/357ee849-a323-417b-b17a-79cf8e648a61%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB%2BAj0sFJ-CXCMUMnu11BDBFr48NmPFO1uzXG3fNQD1o_3N5Zw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to