I am using Djoser along with Django REST Framework. This is my urls.py
:
from django.urls import path, include
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
djoser_urls = [
path("auth/", include("djoser.urls")),
path("auth/", include("djoser.urls.authtoken")),
]
urlpatterns = router.urls + djoser_urls
When using the browsable API at localhost:8000/auth/
the djoser
urls are available. So that is all working correctly.
What I need is to be able to browse to localhost:8000/
and have the above route displayed as an option to click on. Currently there are no routes displayed in the browsable API at localhost:8000/
even though if I manually type localhost:8000/auth/
into the url then I am taken to the djoser
urls.
In other words, when opening the browsable API at localhost:8000/
, I would like the following to be available to click on:
{
"auth": "http://localhost:8000/auth/"
}
question from:
https://stackoverflow.com/questions/65913779/add-django-rest-framework-route-to-third-party-urls 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…