from django.urls import path, include from drf_spectacular.views import SpectacularJSONAPIView, SpectacularRedocView from baserow.core.registries import plugin_registry, application_type_registry from .settings import urls as settings_urls from .user import urls as user_urls from .user_files import urls as user_files_urls from .groups import urls as group_urls from .templates import urls as templates_urls from .applications import urls as application_urls app_name = 'baserow.api' urlpatterns = [ path('schema.json', SpectacularJSONAPIView.as_view(), name='json_schema'), path( 'redoc/', SpectacularRedocView.as_view(url_name='api:json_schema'), name='redoc' ), path('settings/', include(settings_urls, namespace='settings')), path('user/', include(user_urls, namespace='user')), path('user-files/', include(user_files_urls, namespace='user_files')), path('groups/', include(group_urls, namespace='groups')), path('templates/', include(templates_urls, namespace='templates')), path('applications/', include(application_urls, namespace='applications')) ] + application_type_registry.api_urls + plugin_registry.api_urls
#: The Pulp Platform v3 API router, which can be used to manually register ViewSets with the API. root_router = routers.DefaultRouter() urlpatterns = [ url(r"^{api_root}repair/".format(api_root=API_ROOT), RepairView.as_view()), url(r"^{api_root}status/".format(api_root=API_ROOT), StatusView.as_view()), url(r"^{api_root}orphans/".format(api_root=API_ROOT), OrphansView.as_view()), url(r"^auth/", include("rest_framework.urls")), path(settings.ADMIN_SITE_URL, admin.site.urls), ] urlpatterns.append( url( r"^{api_root}docs/api.json".format(api_root=API_ROOT), SpectacularJSONAPIView.as_view(), name="schema", )) urlpatterns.append( url( r"^{api_root}docs/api.yaml".format(api_root=API_ROOT), SpectacularYAMLAPIView.as_view(), name="schema-yaml", )) urlpatterns.append( url( r"^{api_root}docs/".format(api_root=API_ROOT), SpectacularRedocView.as_view( url="/pulp/api/v3/docs/api.json?include_html=1"),
) # noinspection PyUnresolvedReferences from hacktheback.rest.openapi import JSONWebTokenAuthenticationScheme # URL patterns for hacker APIs hacker_urlpatterns = [ path("", include("hacktheback.rest.forms.hacker_urls")), ] # URL patterns for admin APIs admin_urlpatterns = [ path("account/", include("hacktheback.rest.account.admin_urls")), path("messenger/", include("hacktheback.rest.messenger.admin_urls")), path("", include("hacktheback.rest.forms.admin_urls")), ] urlpatterns = [ path("account/", include("hacktheback.rest.account.urls")), path("", include(hacker_urlpatterns)), path("admin/", include(admin_urlpatterns)), path("schema", SpectacularAPIView.as_view(), name="schema"), path("schema.json", SpectacularJSONAPIView.as_view(), name="schema-json"), path("schema.yaml", SpectacularYAMLAPIView.as_view(), name="schema-yaml"), path( "swagger", SpectacularSwaggerView.as_view(url_name="schema-yaml"), name="swagger", ), ]
from django.urls import include, path from drf_spectacular.views import SpectacularJSONAPIView, SpectacularRedocView urlpatterns = [ path('/openapi.json', SpectacularJSONAPIView.as_view(), name='api-schema'), path('/schema', SpectacularRedocView.as_view(url_name="api-schema"), name='schema-redoc'), path('/auth/', include('vng.api.v1.api_authentication.urls', namespace='apiv1_auth')), path('/', include('vng.api.v1.testsession.urls', namespace='apiv1session')), path('/', include('vng.api.v1.servervalidation.urls', namespace='apiv1server')), path( '/', include('vng.api.v1.open_api_inspector.urls', namespace='apiv1inspector')), path( '/', include('vng.api.v1.design_rules.urls', namespace='api_v1_design_rules')), ]
] exts_pool.load_all() urlpatterns += exts_pool.get_urls() extra_routes = core_signals.extra_uprefs_routes.send(sender="urls") if extra_routes: extra_routes = reduce(lambda a, b: a + b, [route[1] for route in extra_routes]) urlpatterns += extra_routes # API urls urlpatterns += [ # FIXME: legacy, to remove ASAP path('docs/openapi.json', SpectacularJSONAPIView.as_view(api_version="v1"), name='schema-v1-legacy'), path('api/schema-v1/', SpectacularJSONAPIView.as_view(api_version="v1"), name='schema-v1'), path('api/schema-v1/swagger/', SpectacularSwaggerView.as_view(url_name='schema-v1'), name='docs-index-v1'), path('api/schema-v1/redoc/', SpectacularRedocView.as_view(url_name='schema-v1')), path('api/schema-v2/', SpectacularJSONAPIView.as_view(api_version="v2"), name='schema-v2'), path('api/schema-v2/swagger/', SpectacularSwaggerView.as_view(url_name='schema-v2'), name='docs-index-v2'),
from django.contrib import admin from django.urls import include, path from drf_spectacular.views import SpectacularJSONAPIView, SpectacularSwaggerView urlpatterns = [ path("", include("api.urls")), path("admin/", admin.site.urls), path("openapi.json", SpectacularJSONAPIView.as_view(), name="schema"), path("docs/", SpectacularSwaggerView.as_view(url_name="schema")), ]
path( f"{API_ROOT}repositories/reclaim_space/", ReclaimSpaceViewSet.as_view({"post": "reclaim"}), ), path( f"{API_ROOT}importers/core/pulp/import-check/", PulpImporterImportCheckView.as_view(), ), path("auth/", include("rest_framework.urls")), path(settings.ADMIN_SITE_URL, admin.site.urls), ] urlpatterns.append( path( f"{API_ROOT}docs/api.json", SpectacularJSONAPIView.as_view(authentication_classes=[], permission_classes=[]), name="schema", )) urlpatterns.append( path( f"{API_ROOT}docs/api.yaml", SpectacularYAMLAPIView.as_view(authentication_classes=[], permission_classes=[]), name="schema-yaml", )) urlpatterns.append( path( f"{API_ROOT}docs/", SpectacularRedocView.as_view(
Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from drf_spectacular.views import SpectacularJSONAPIView from drf_spectacular.views import SpectacularRedocView from drf_spectacular.views import SpectacularSwaggerView from drf_spectacular.views import SpectacularYAMLAPIView urlpatterns = [ # Open API 자체를 조회 : json, yaml, path("docs/json/", SpectacularJSONAPIView.as_view(), name="schema-json"), path("docs/yaml/", SpectacularYAMLAPIView.as_view(), name="swagger-yaml"), # Open API Document UI로 조회: Swagger, Redoc path( "docs/swagger/", SpectacularSwaggerView.as_view(url_name="schema-json"), name="swagger-ui", ), path( "docs/redoc/", SpectacularRedocView.as_view(url_name="schema-json"), name="redoc", ), ]
Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.urls import path, include, re_path from django.views.generic.base import RedirectView from django.conf import settings from django.views.static import serve from drf_spectacular.views import SpectacularJSONAPIView, SpectacularRedocView, SpectacularSwaggerView urlpatterns = [ path('', RedirectView.as_view(url='swagger/ui/')), path('swagger/json/', SpectacularJSONAPIView.as_view(), name='schema'), # Optional UI: path('swagger/ui/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'), path('swagger/redoc/', SpectacularRedocView.as_view(url_name='schema'), name='redoc'), path('user/', include('users.urls')), path('auth/', include('auths.urls')), path('demand/', include('demand.urls')) ] # 生产环境中使 API 文档也可访问 if not settings.DEBUG: urlpatterns += [re_path(r'^static/(?P<path>.*)$', serve, {'document_root': settings.STATIC_ROOT})]