urlpatterns = [ # Django Admin, use {% url 'admin:index' %} path(settings.ADMIN_URL, admin.site.urls), # API Root View Session Auth path("root-view-auth", include("rest_framework.urls", namespace="rest_framework")), # API V1 path( "v1/", include( ( [ # TODO: custom urls includes go here # === root view path("", APIRootView.as_view(), name="root") ], "techsalerno", ), namespace="v1", ), ), # Service Root View path("", RedirectView.as_view(url=reverse_lazy("v1:root"), permanent=False)), ] # include media urls from django settings for correct path calculation urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) if settings.DEBUG: # This allows the error pages to be debugged during development.
# helpers class RedirectWithRootDomain(RedirectView): def get_redirect_url(self, *args, **kwargs): url = super(RedirectWithRootDomain, self).get_redirect_url(*args, **kwargs) return self.request.scheme + '://' + settings.HOST + url # list views that should appear in the HTML version of the API root root_view = APIRootView.as_view( api_root_dict={ 'folders': 'folders', 'capture_jobs': 'capture_jobs', 'archives': 'archives', 'public_archives': 'public_archives', 'organizations': 'organizations', 'user': '******', }) # reverse() URL namespace app_name = 'api' # The previous version of the API had a number of endpoints under /user instead of at the top level. # This regex lets endpoints work with or without /user at the start. legacy_user_prefix = r'^(?:user/)?' urlpatterns = [ # /v1 url(
# pylint: disable=invalid-name """shared_bills URL Configuration""" from django.conf import settings from django.contrib import admin from django.urls import include, path from rest_framework.routers import APIRootView api_root_views = { "events": "events-list", "user": "******", "get token": "token-obtain-pair", "verify token": "token-verify", } urlpatterns = [ path("admin/", admin.site.urls), path("api/", APIRootView.as_view(api_root_dict=api_root_views), name="api-root"), path("api/", include("bills.urls")), path("api/", include("accounts.urls")), ] if settings.DEBUG: urlpatterns.append(path("auth/", include("rest_framework.urls")))
from django.conf.urls import url from rest_framework.routers import APIRootView from perma.urls import guid_pattern from . import views # list views that should appear in the HTML version of the API root root_view = APIRootView.as_view(api_root_dict={ 'folders': 'folders', 'capture_jobs': 'capture_jobs', 'archives': 'archives', 'public_archives': 'public_archives', 'organizations': 'organizations', 'user': '******', }) # reverse() URL namespace app_name = 'api2' # The previous version of the API had a number of endpoints under /user instead of at the top level. # This regex lets endpoints work with or without /user at the start. legacy_user_prefix = r'^(?:user/)?' urlpatterns = [ # /folders url(legacy_user_prefix + r'folders/?$', views.FolderListView.as_view(), name='folders'), # /folders/:id url(legacy_user_prefix + r'folders/(?P<pk>[0-9]+)/?$', views.FolderDetailView.as_view()), # /folders/:id/folders
from rest_framework.routers import APIRootView from rest_framework.schemas import get_schema_view schema_view = get_schema_view(title='Ejudge server') api_root_view = APIRootView.as_view(api_root_dict={ 'io': 'io-api-root', 'code': 'code-api-root', }) class IndexView(APIRootView): """ Index page. """ index_view = IndexView.as_view(api_root_dict={ 'api': 'api-root', 'schema': 'schema', 'login': '******', })
from django.urls import path from django.views.generic import TemplateView from rest_framework.routers import APIRootView from . import views # list views that should appear in the HTML version of the API root root_view = APIRootView.as_view(api_root_dict={ 'event': 'event', 'events': 'events' }) urlpatterns = [ path('new_event', views.EventView.as_view(), name='event'), path('events', views.ListEventsView.as_view(), name='events'), path('endpoints', root_view), path('rooms/<room_name>', views.room), path('rooms/<room_name>/<int:em>', views.room), path('rooms/<room_name>/<int:em>/<str:color>', views.room), path('', views.room, kwargs={"room_name": "display"}), ]
from rest_framework.routers import APIRootView from django.urls import path from . import views # list views that should appear in the HTML version of the API root root_view = APIRootView.as_view(api_root_dict={ 'applications': 'applications', 'maintenance_events': 'maintenance_events' }) urlpatterns = [ # url(r'^$', views.index, name='index') path('api/', root_view), path('api/applications/', views.ApplicationListView.as_view(), name='applications'), path('api/applications/<int:pk>/', views.ApplicationDetailView.as_view(), name='applications_detail'), path('api/applications/<int:pk>/maintenance-events/', views.ApplicationMaintenanceEventListView.as_view(), name='applications_events'), path('api/maintenance-events/', views.MaintenanceEventListView.as_view(), name='maintenance_events'), path('api/maintenance-events/<int:pk>/', views.MaintenanceEventDetailView.as_view(), name='maintenance_events_detail'), path('<app>/<tier>', views.maintenance_monitor, name='maintenance_monitor') ]