8050ae1e1f92026211180802e928f1b6ba4fb928
[redakcja.git] / src / redakcja / urls.py
1 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from django.conf.urls import url
5 from django.urls import include, path
6 from django.contrib import admin
7 from django.conf import settings
8 from django.conf.urls.static import static
9 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
10 from django.views.generic import RedirectView
11 import django_cas_ng.views
12
13
14
15 urlpatterns = [
16     #url(r'^admin/login/$', django_cas_ng.views.login, name='login'),
17     #url(r'^admin/logout/$', django_cas_ng.views.logout, name='logout'),
18
19     # Admin panel
20     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
21     url(r'^admin/', admin.site.urls),
22     path('catalogue/', include('catalogue.urls')),
23     url(r'^$', RedirectView.as_view(url='/documents/', permanent=False)),
24     url(r'^documents/', include('documents.urls')),
25     url(r'^apiclient/', include('apiclient.urls')),
26     url(r'^editor/', include('wiki.urls')),
27     url(r'^images/', include('wiki_img.urls')),
28     url(r'^cover/', include('cover.urls')),
29     url(r'^wlxml/', include('wlxml.urls')),
30 ]
31
32
33 if settings.CAS_SERVER_URL:
34     urlpatterns += [
35         url(r'^accounts/login/$', django_cas_ng.views.LoginView.as_view(), name='cas_ng_login'),
36         url(r'^accounts/logout/$', django_cas_ng.views.LogoutView.as_view(), name='logout'),
37     ]
38 else:
39     import django.contrib.auth.views
40     urlpatterns += [
41         url(r'^accounts/login/$', django.contrib.auth.views.LoginView.as_view(), name='cas_ng_login'),
42         url(r'^accounts/', include('django.contrib.auth.urls')),
43     ]
44
45
46 if settings.DEBUG:
47     urlpatterns += staticfiles_urlpatterns()
48     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
49
50     import debug_toolbar
51     urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls))]