1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 11:16:47 +00:00
webvirtcloud/webvirtcloud/urls.py
catborise abe3b7ee63 refactor: settings are read through django.conf
instances/forms.py and instances/models.py imported values from the
webvirtcloud.settings module itself, which bypasses DJANGO_SETTINGS_MODULE
(settings-dev, test overrides) and runs the module a second time. They
now read django.conf.settings. webvirtcloud/urls.py also loses its
fallback that set REST_FRAMEWORK's schema class at import for settings.py
copies without it: the template sets it, and an older settings.py is
rebuilt from the template when updating.
2026-11-06 11:01:51 +03:00

40 lines
1.5 KiB
Python

from django.conf import settings
from django.urls import include, path, re_path
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularRedocView,
SpectacularSwaggerSplitView,
)
from appsettings.views import appsettings
from console.views import console
from instances.views import index
urlpatterns = [
path("", index, name="index"),
path("admin/", include(("admin.urls", "admin"), namespace="admin")),
path("accounts/", include("accounts.urls")),
path("appsettings/", appsettings, name="appsettings"),
path("computes/", include("computes.urls")),
path("console/<int:compute_id>/<str:uuid>/", console, name="console"),
path("datasource/", include("datasource.urls")),
path("instances/", include("instances.urls")),
path("i18n/", include("django.conf.urls.i18n")),
path("logs/", include("logs.urls")),
path("jobs/", include("operations.urls")),
path('api/v1/', include("webvirtcloud.urls-api")),
path("api/schema/", SpectacularAPIView.as_view(), name="schema"),
re_path(r"^swagger\.(?P<format>json|yaml)$", SpectacularAPIView.as_view(), name="schema-json"),
path("swagger/", SpectacularSwaggerSplitView.as_view(url_name="schema"), name="schema-swagger-ui"),
path("redoc/", SpectacularRedocView.as_view(url_name="schema"), name="schema-redoc"),
]
if settings.DEBUG:
try:
import debug_toolbar
urlpatterns += [
path("__debug__/", include(debug_toolbar.urls)),
]
except ImportError:
pass