When I change admin URL, my project API URL not found. how can I solve it?

path("admin/", admin.site.urls), to path("", admin.site.urls), That much is fine.

but API Not Found

I need path("api/", include("config.api_router")),

Note: when I use it path("admin/", admin.site.urls), API is worked

Django URL dispatcher runs through each URL pattern, in order, and stops at the first one that matches the requested URL. Try switching the order:

urlpatterns = [
    path("api/", include("config.api_router")),
    # other urls
    path("", admin.site.urls)
]
Back to Top