Tuesday, September 3, 2019

Re: Weird django.urls.exceptions.NoReverseMatch: 'review' is not a registered namespace

Hi,

- I don't see where you include the urls from the reviews app in your main urls.py file.
- To use the "review:detail" notation, you need to enable namespaces.

So it seems that what you lack in your mysite/urls.py file is path("reviews/", include("reviews.urls", namespace="reviews")) You should then be able to use reverse("reviews:detail").

Julien Enselme
Développeur chez BureauxLocaux


Le lun. 2 sept. 2019 à 15:39, Pasquale <pasqui023@gmail.com> a écrit :
I have in mysite/urls.py:

from django.contrib import admin
from django.urls import include, path
from django.contrib.auth import views as auth_views
from django.conf import settings
from .views import *

urlpatterns = [
    path('admin/', admin.site.urls, name="admin"),
    path("places/", include("places.urls"), name="places"),
    path("review/", include('django_comments_xtd.urls'), name="review"),
    path('accounts/', include('allauth.urls')),
    path("", HomeView.as_view(), name="home")
]

if settings.DEBUG:
    import debug_toolbar
    urlpatterns += [
        path('__debug__/', include(debug_toolbar.urls)),
    ]


and in reviews/urls.py

from django.urls import path, include
from . import views as v
app_name="review"
urlpatterns = [
    path("<int:pk>", v.ReviewsDetail.as_view(), name="detail"),
]
but if I do reverse("review:detail) I get a NoReverseMatch.

How?


--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3e47da2-b257-5f61-3510-cfaed6c2d752%40gmail.com.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAL%3D_h26yMO%3De%3DL1t-kK34s02Uhq%2Bc%2B%3DYcywiJHm6rBso%3Dy-Gqw%40mail.gmail.com.

No comments:

Post a Comment