Coverage for apis_core/urls.py: 100%

30 statements  

« prev     ^ index     » next       coverage.py v7.6.8, created at 2024-12-20 09:24 +0000

1from django.conf import settings 

2from django.contrib import admin 

3from django.urls import include, path 

4from drf_spectacular.views import ( 

5 SpectacularAPIView, 

6 SpectacularRedocView, 

7 SpectacularSwaggerView, 

8) 

9 

10from apis_core.generic.routers import CustomDefaultRouter 

11 

12app_name = "apis_core" 

13 

14urlpatterns = [ 

15 path("", include("apis_core.core.urls")), 

16 path("", include("apis_core.generic.urls")), 

17 path("admin/", admin.site.urls), 

18 path("accounts/", include("django.contrib.auth.urls")), 

19] 

20 

21router = CustomDefaultRouter() 

22 

23 

24if "apis_core.apis_metainfo" in settings.INSTALLED_APPS: 

25 from apis_core.apis_metainfo.urls import router as apis_metainfo_router 

26 

27 router.registry.extend(apis_metainfo_router.registry) 

28 

29 

30if "apis_core.apis_entities" in settings.INSTALLED_APPS: 

31 urlpatterns.append(path("entities/", include("apis_core.apis_entities.urls"))) 

32 from apis_core.apis_entities.urls import api_routes 

33 

34 urlpatterns.append(path("api/", include(api_routes))) 

35 

36 

37if "apis_core.apis_relations" in settings.INSTALLED_APPS: 

38 urlpatterns.append(path("relations/", include("apis_core.apis_relations.urls"))) 

39 

40 

41if "apis_core.relations" in settings.INSTALLED_APPS: 

42 urlpatterns.append(path("relations/", include("apis_core.relations.urls"))) 

43 

44 

45if "apis_core.history" in settings.INSTALLED_APPS: 

46 urlpatterns.append(path("history/", include("apis_core.history.urls"))) 

47 

48 

49if "apis_core.collections" in settings.INSTALLED_APPS: 

50 urlpatterns.append(path("collections/", include("apis_core.collections.urls"))) 

51 

52 

53if "apis_core.documentation" in settings.INSTALLED_APPS: 

54 urlpatterns.append(path("", include("apis_core.documentation.urls"))) 

55 

56 

57urlpatterns.append(path("api/", include(router.urls))) 

58urlpatterns.append(path("api-auth/", include("rest_framework.urls"))) 

59 

60 

61urlpatterns.append(path("swagger/schema/", SpectacularAPIView.as_view(), name="schema")) 

62urlpatterns.append( 

63 path( 

64 "swagger/schema/swagger-ui/", 

65 SpectacularSwaggerView.as_view(url_name="apis_core:schema"), 

66 name="swagger-ui", 

67 ) 

68) 

69urlpatterns.append( 

70 path( 

71 "swagger/schema/redoc/", 

72 SpectacularRedocView.as_view(url_name="apis_core:schema"), 

73 name="redoc", 

74 ) 

75)