Home > Blockchain >  django can't find url even though it is there
django can't find url even though it is there

Time:08-24

I have an issue where I try to go to my redirect page and get a NoReverseMatch when though the URL is there? Any idea how to fix this?

I have checked that the "schema" url works and it correctly supplies the openapi schema, but the other page simply can't understand the url.

URLS:

urlpatterns = [
    path("schema/", SpectacularAPIView.as_view(), name="schema"),
    # Optional UI:
    path("docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
]

Errors: enter image description here

enter image description here

CodePudding user response:

For reverse url pathing, you have to use {% url api:schema %}. It's specified as namespace next to include('api.urls') or inside app urls, just above urlpatterns - like app_name = "api".

  • Related