38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
from django.conf import settings
|
|
from django.contrib import admin
|
|
from django.urls import include, path
|
|
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
|
|
from rest_framework.response import Response
|
|
from rest_framework.views import APIView
|
|
|
|
from jobs.views import HealthAPIView
|
|
|
|
|
|
class ConfigAPIView(APIView):
|
|
def get(self, request):
|
|
return Response(
|
|
{
|
|
"default_priority": 50,
|
|
"job_types": [
|
|
"demo.success",
|
|
"demo.fail",
|
|
"demo.slow",
|
|
"demo.timeout",
|
|
"demo.flaky",
|
|
],
|
|
}
|
|
)
|
|
|
|
|
|
urlpatterns = [
|
|
path("admin/", admin.site.urls),
|
|
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
|
|
path("api/docs/", SpectacularSwaggerView.as_view(url_name="schema"), name="swagger-ui"),
|
|
path("api/health/", HealthAPIView.as_view(), name="health"),
|
|
path("api/config/", ConfigAPIView.as_view(), name="config"),
|
|
path("api/", include("jobs.urls")),
|
|
]
|
|
|
|
if settings.ENABLE_DJANGO_DEBUG_TOOLBAR:
|
|
urlpatterns.append(path("__debug__/", include("debug_toolbar.urls")))
|