You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.4 KiB

3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
  1. """app URL Configuration
  2. The `urlpatterns` list routes URLs to views. For more information please see:
  3. https://docs.djangoproject.com/en/2.0/topics/http/urls/
  4. Examples:
  5. Function views
  6. 1. Add an import: from my_app import views
  7. 2. Add a URL to urlpatterns: path('', views.home, name='home')
  8. Class-based views
  9. 1. Add an import: from other_app.views import Home
  10. 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
  11. Including another URLconf
  12. 1. Import the include() function: from django.urls import include, path
  13. 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
  14. """
  15. import os
  16. import re
  17. from django.conf import settings
  18. from django.contrib import admin
  19. from django.contrib.auth.views import TemplateView
  20. from django.urls import include, path, re_path
  21. from django.views.static import serve
  22. from drf_yasg import openapi
  23. from drf_yasg.views import get_schema_view
  24. schema_view = get_schema_view(
  25. openapi.Info(
  26. title="doccano API",
  27. default_version="v1",
  28. description="doccano API description",
  29. license=openapi.License(name="MIT License"),
  30. ),
  31. public=True,
  32. )
  33. urlpatterns = []
  34. if settings.DEBUG or os.environ.get("STANDALONE", False):
  35. # For showing images and audios in the case of pip and Docker.
  36. urlpatterns.append(
  37. re_path(
  38. r"^%s(?P<path>.*)$" % re.escape(settings.MEDIA_URL.lstrip("/")),
  39. serve,
  40. {"document_root": settings.MEDIA_ROOT},
  41. )
  42. )
  43. urlpatterns += [
  44. path("admin/", admin.site.urls),
  45. path("api-auth/", include("rest_framework.urls")),
  46. path("v1/health/", include("health_check.urls")),
  47. path("v1/", include("api.urls")),
  48. path("v1/", include("roles.urls")),
  49. path("v1/", include("users.urls")),
  50. path("v1/", include("data_import.urls")),
  51. path("v1/", include("data_export.urls")),
  52. path("v1/", include("projects.urls")),
  53. path("v1/projects/<int:project_id>/metrics/", include("metrics.urls")),
  54. path("v1/projects/<int:project_id>/", include("auto_labeling.urls")),
  55. path("v1/projects/<int:project_id>/", include("examples.urls")),
  56. path("v1/projects/<int:project_id>/", include("labels.urls")),
  57. path("v1/projects/<int:project_id>/", include("label_types.urls")),
  58. path("swagger/", schema_view.with_ui("swagger", cache_timeout=0), name="schema-swagger-ui"),
  59. re_path("", TemplateView.as_view(template_name="index.html")),
  60. ]