Djangorestframework - 公共 url 基础下的所有 api 路径

Djangorestframework - All api paths under a common url base

django 2.1,python3.6,djangorestframework

是否可以创建一个包含多个模型的 api 路径?

urlpatterns = [
   ...
    path('api/', include('cards.api.urls')),
    path('api2/', include('decks.api.urls')),
]

urlpatterns = [
   ...
    path('api/', include('cards.api.urls', 'decks.api.urls')),
]

我收到以下错误消息

Specifying a namespace in include() without providing an app_name '
django.core.exceptions.ImproperlyConfigured: Specifying a namespace in include() without providing an app_name is not supported. Set the app_name attribute in the included module, or pass a 2-tuple containing the list of patterns and app_name instead.

我希望能够将我所有的 api 通话都集中在一个 url

随便用,

urlpatterns = [
   ...
    path('api/', include('cards.api.urls')),
    path('api/', include('decks.api.urls')),
]