Monday, March 28, 2016

Re: Getting NoReverseMatch at /logout/

On Mon, Mar 28, 2016 at 6:26 AM, Vadim Serdiuk <va.serdyuk@gmail.com> wrote:
Hello.
The exception raises because 'boardgames_home' name is defined for group of patterns, and not one.
So it was skiped and is undefined in runtime. 
Use 'name' parameter only for individual pattern, don't use it when include other patterns. 

That's not entirely accurate. It is perfectly valid to assign a name to an included set of URL's. This creates a namespace for the URL's that are being included. See here:


The OP is incorrectly trying to reverse the parent namespace ('boardgames_home') rather than the full name of the URL in question ('boardgames_home:home' per the current namespace setup), which can't be resolved directly because the parent namespace refers to an include() for zero or more other patterns.
 

Also don't use blank string in url pattern. Use '/' for home page instead of ''.


Correct, using an empty string will definitely cause you problems down the road. With an empty string and the current ordering of the URL definitions, I believe URL matching for login/ and logout/ will fail consistently. 

-James

--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVn-yeMcZXbsuagtAuDXvgRTsQ_b%2Bt4%3DwOS8sZ1cNx89A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment