Thursday, July 2, 2015

Re: NoReverseMatch in Django (url ploblem)


> > I'm a beginner of Django I want to set my url with database field_name
> > instead of use primary key from Django tutorial. This is my code.
> >
> > *mysite*
> > **dwru/urls.py**
> > urlpatterns = [
> >     url(r'^$', include('product.urls', namespace="product")),
> > ]
>
> This regex is incorrect, and will only match a URL of '/', which is
> probably not what you want (since you are making other URL's like
> '/TestCA01' down below). You need to remove the $ from the regex to
> pass along the entire URL string to the include. You probably need a
> slash in there also to remove it as a prefix when it is passed along
> to the include:
>
> url(r'^/', include('product.urls', namespace="product")),
>

I was thinking about this and you may not need the /, if it doesn't work, try without it. I'm not in front of a computer to verify.

-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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUD%2BvTpS71q2EGz8F-Qc9StWtOxx%3Df2WTHWmdtKzQX6Fw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment