urls.py 1.08 KB
Newer Older
1 2
from django.conf import settings
from django.conf.urls.static import static
Florent Chehab's avatar
Florent Chehab committed
3 4
from django.conf.urls import include, url
from django.contrib import admin
5
from django.views.generic.base import RedirectView
Florent Chehab's avatar
Florent Chehab committed
6
import django_cas_ng.views
7
from . import views
Florent Chehab's avatar
Florent Chehab committed
8 9 10

if settings.DEBUG:
    import debug_toolbar
11 12

    urlpatterns = [url(r"^__debug__/", include(debug_toolbar.urls))]
Florent Chehab's avatar
Florent Chehab committed
13 14
else:
    urlpatterns = []
Florent Chehab's avatar
Florent Chehab committed
15 16

urlpatterns += [
17
    # TODO remove this before going to full prod
18 19
    url(r"^role_change/", views.role_change),
    url(r"^admin/", admin.site.urls),
Florent Chehab's avatar
Florent Chehab committed
20
    url(r"^user/login$", django_cas_ng.views.LoginView.as_view(), name="cas_ng_login"),
Florent Chehab's avatar
Florent Chehab committed
21 22 23 24 25 26 27 28
    url(
        r"^user/logout$", django_cas_ng.views.LogoutView.as_view(), name="cas_ng_logout"
    ),
    url(
        r"^user/callback$",
        django_cas_ng.views.CallbackView.as_view(),
        name="cas_ng_proxy_callback",
    ),
29 30 31
    url(r"^app/.*", include("frontend_app.urls")),
    url(r"^$", RedirectView.as_view(url="./app/"), name="go to real home"),
    url(r"", include("backend_app.urls")),
32
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)