Django 在可浏览的API中只看到一个端点,而不是两个端点
为什么在django rest可浏览API中只能看到一个URL(Django 在可浏览的API中只看到一个端点,而不是两个端点,django,django-rest-framework,Django,Django Rest Framework,为什么在django rest可浏览API中只能看到一个URL(用户),而不能同时看到这两个URL 网址: 我希望看到用户和属性 accounts.url: from django.urls import path, include from accounts.views import UserViewSet from rest_framework import routers router = routers.DefaultRouter() router.register(r"users"
用户
),而不能同时看到这两个URL
网址:
我希望看到用户
和属性
accounts.url:
from django.urls import path, include
from accounts.views import UserViewSet
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r"users", UserViewSet)
urlpatterns = [path("", include(router.urls))]
properties.url:
from django.urls import path, include
from properties.views import PropertyViewSet, UnitViewSet
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r"properties", PropertyViewSet)
router.register(r"units", UnitViewSet)
urlpatterns = [path("", include(router.urls))]
API是否有未列出的身份验证令牌?两个路径匹配完全相同的内容,您是否可以尝试为每个路径指定一个唯一的路径,看看这是否会改变什么?@IainShelvington因此,如果我向其中一个路径添加一些内容,那么另一个“空”路径应该会显示出来。然而,我认为如果我将两个URL都留空,那么两个URL都会显示出来。看起来好像显示了第一个匹配的url,而不是两个都显示
from django.urls import path, include
from properties.views import PropertyViewSet, UnitViewSet
from rest_framework import routers
router = routers.DefaultRouter()
router.register(r"properties", PropertyViewSet)
router.register(r"units", UnitViewSet)
urlpatterns = [path("", include(router.urls))]