2017-05-31 02:38:59 +02:00
|
|
|
from contextlib import suppress
|
|
|
|
|
2022-04-04 01:13:48 +02:00
|
|
|
from channels.routing import URLRouter
|
2017-05-29 15:59:49 +02:00
|
|
|
from django.conf import settings
|
2023-11-05 18:47:20 +01:00
|
|
|
from django.conf.urls.static import static
|
2016-07-07 17:25:33 +02:00
|
|
|
from django.contrib import admin
|
2022-04-03 16:42:17 +02:00
|
|
|
from django.urls import include, path
|
2016-07-07 17:25:33 +02:00
|
|
|
|
2024-02-07 18:17:13 +01:00
|
|
|
urlpatterns = []
|
|
|
|
websocket_urlpatterns = []
|
|
|
|
|
|
|
|
if settings.SERVE_ANYTHING:
|
|
|
|
import c3nav.control.urls
|
|
|
|
import c3nav.editor.urls
|
|
|
|
import c3nav.mapdata.urls
|
|
|
|
import c3nav.site.urls
|
|
|
|
urlpatterns += [
|
|
|
|
path('editor/', include(c3nav.editor.urls)),
|
|
|
|
path('map/', include(c3nav.mapdata.urls)),
|
|
|
|
path('admin/', admin.site.urls),
|
|
|
|
path('control/', include(c3nav.control.urls)),
|
|
|
|
]
|
|
|
|
|
|
|
|
if settings.SERVE_API:
|
|
|
|
import c3nav.api.urls
|
|
|
|
urlpatterns += [
|
|
|
|
path('api/', include(c3nav.api.urls)),
|
|
|
|
]
|
|
|
|
|
|
|
|
if settings.ENABLE_MESH:
|
|
|
|
import c3nav.mesh.urls
|
|
|
|
urlpatterns += [
|
|
|
|
path('mesh/', include(c3nav.mesh.urls)),
|
|
|
|
]
|
|
|
|
|
|
|
|
urlpatterns += [
|
|
|
|
path('locales/', include('django.conf.urls.i18n')),
|
|
|
|
path('', include(c3nav.site.urls)),
|
|
|
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
|
|
|
|
|
|
|
if settings.ENABLE_MESH:
|
|
|
|
websocket_urlpatterns += [
|
|
|
|
path('mesh/', URLRouter(c3nav.mesh.urls.websocket_urlpatterns)),
|
|
|
|
]
|
|
|
|
|
|
|
|
if settings.DEBUG:
|
|
|
|
with suppress(ImportError):
|
|
|
|
import debug_toolbar
|
|
|
|
urlpatterns.insert(0, path('__debug__/', include(debug_toolbar.urls)))
|
2024-03-29 23:38:04 +01:00
|
|
|
|
2024-03-30 22:12:27 +01:00
|
|
|
if settings.METRICS:
|
2024-03-29 23:38:04 +01:00
|
|
|
with suppress(ImportError):
|
2024-12-02 21:10:35 +01:00
|
|
|
import django_prometheus # noqa
|
2024-09-20 01:09:45 +02:00
|
|
|
from c3nav.mapdata.views import prometheus_exporter
|
2024-09-20 00:59:15 +02:00
|
|
|
urlpatterns += [
|
2024-09-20 01:09:45 +02:00
|
|
|
path('prometheus/metrics', prometheus_exporter, name='prometheus-exporter'),
|
2024-09-20 00:59:15 +02:00
|
|
|
]
|
2024-09-10 00:37:45 +02:00
|
|
|
|
|
|
|
if settings.SSO_ENABLED:
|
|
|
|
urlpatterns += [
|
|
|
|
path('sso/', include('social_django.urls', namespace='social'))
|
|
|
|
]
|