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.

48 lines
1.7 KiB

6 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. from django.conf import settings
  16. from django.contrib import admin
  17. from django.urls import path, include, re_path
  18. from django.conf.urls.static import static
  19. from django.contrib.auth.views import TemplateView
  20. from drf_yasg.views import get_schema_view
  21. from drf_yasg import openapi
  22. # TODO: adds AnnotationList and AnnotationDetail endpoint.
  23. schema_view = get_schema_view(
  24. openapi.Info(
  25. title="doccano API",
  26. default_version='v1',
  27. description="doccano API description",
  28. license=openapi.License(name="MIT License"),
  29. ),
  30. public=True,
  31. )
  32. urlpatterns = [
  33. path('admin/', admin.site.urls),
  34. path('social/', include('social_django.urls')),
  35. path('api-auth/', include('rest_framework.urls')),
  36. path('v1/', include('api.urls')),
  37. path('swagger/', schema_view.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
  38. re_path('', TemplateView.as_view(template_name='index.html')),
  39. ]
  40. if 'cloud_browser' in settings.INSTALLED_APPS:
  41. urlpatterns.append(path('cloud-storage/', include('cloud_browser.urls')))
  42. if settings.DEBUG:
  43. urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)