Fix.
[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.urls import include, path
5 from django.contrib import admin
6 from django.conf import settings
7 from django.conf.urls.static import static
8 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
9 from django.views.generic import RedirectView
10 import django_cas_ng.views
11
12
13
14 urlpatterns = [
15     #url(r'^admin/login/$', django_cas_ng.views.login, name='login'),
16     #url(r'^admin/logout/$', django_cas_ng.views.logout, name='logout'),
17
18     # Admin panel
19     path('admin/doc/', include('django.contrib.admindocs.urls')),
20     path('admin/', admin.site.urls),
21     path('catalogue/', include('catalogue.urls')),
22     path('', RedirectView.as_view(url='/documents/', permanent=False)),
23     path('documents/', include('documents.urls')),
24     path('apiclient/', include('apiclient.urls')),
25     path('editor/', include('wiki.urls')),
26     path('images/', include('wiki_img.urls')),
27     path('cover/', include('cover.urls')),
28     path('depot/', include('depot.urls')),
29     path('wlxml/', include('wlxml.urls')),
30     path('isbn/', include('isbn.urls')),
31     path('sources/', include('sources.urls')),
32
33     path('api/', include('redakcja.api.urls')),
34 ]
35
36
37 if settings.CAS_SERVER_URL:
38     urlpatterns += [
39         path('accounts/login/', django_cas_ng.views.LoginView.as_view(), name='cas_ng_login'),
40         path('accounts/logout/', django_cas_ng.views.LogoutView.as_view(), name='logout'),
41     ]
42 else:
43     import django.contrib.auth.views
44     urlpatterns += [
45         path('accounts/login/', django.contrib.auth.views.LoginView.as_view(), name='cas_ng_login'),
46         path('accounts/', include('django.contrib.auth.urls')),
47     ]
48
49
50 if settings.DEBUG:
51     urlpatterns += staticfiles_urlpatterns()
52     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
53
54     import debug_toolbar
55     urlpatterns += [path('__debug__/', include(debug_toolbar.urls))]