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)))
|