This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/root/urls.py

43 lines
1.4 KiB
Python
Raw Normal View History

"""passbook URL Configuration"""
from django.conf import settings
from django.contrib import admin
from django.urls import include, path
from django.views.generic import RedirectView
2019-10-01 08:24:10 +00:00
from structlog import get_logger
from passbook.core.views import error
2019-11-08 11:23:51 +00:00
from passbook.root.monitoring import MetricsView
from passbook.lib.utils.reflection import get_apps
LOGGER = get_logger()
admin.autodiscover()
admin.site.login = RedirectView.as_view(pattern_name='passbook_core:auth-login')
handler400 = error.BadRequestView.as_view()
handler403 = error.ForbiddenView.as_view()
handler404 = error.NotFoundView.as_view()
handler500 = error.ServerErrorView.as_view()
urlpatterns = [
]
for _passbook_app in get_apps():
if hasattr(_passbook_app, 'mountpoint'):
_path = path(_passbook_app.mountpoint, include((_passbook_app.name+'.urls',
_passbook_app.label),
namespace=_passbook_app.label))
urlpatterns.append(_path)
LOGGER.debug("Mounted URLs", app_name=_passbook_app.name)
urlpatterns += [
# Administration
path('administration/django/', admin.site.urls),
2019-11-08 11:23:51 +00:00
path('metrics/', MetricsView.as_view(), name='metrics')
]
if settings.DEBUG:
import debug_toolbar
urlpatterns = [
path('__debug__/', include(debug_toolbar.urls)),
] + urlpatterns