Add banner style.
[wolnelektury.git] / src / wolnelektury / urls.py
1 # This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
3 #
4 from django.conf import settings
5 from django.contrib import admin
6 from django.urls import include, path
7 from django.views.generic import RedirectView
8 import django.views.static
9 from annoy.utils import banner_exempt
10 import catalogue.views
11 import club.views
12 from . import views
13
14
15 urlpatterns = [
16     path('', views.main_page, name='main_page'),
17     path('planowane/', views.publish_plan, name='publish_plan'),
18     path('widget.html', views.widget, name='widget'),
19
20     path('zegar/', views.clock, name='clock'),
21
22     # Authentication
23     path('uzytkownik/', views.user_settings, name='user_settings'),
24     path('uzytkownik/login/', views.WLLoginView.as_view(), name='login'),
25     path('uzytkownik/signup/', views.WLRegisterView.as_view(), name='register'),
26     path('uzytkownik/logout/', views.logout_then_redirect, name='logout'),
27     path('uzytkownik/social/signup/', banner_exempt(views.SocialSignupView.as_view()), name='socialaccount_signup'),
28 ]
29
30 urlpatterns += [
31     path('eksperymenty/', include('experiments.urls')),
32     path('katalog/', include('catalogue.urls')),
33     path('opds/', include('opds.urls')),
34     path('sugestia/', include('suggest.urls')),
35     path('lesmianator/', include('lesmianator.urls')),
36     path('przypisy/', include('dictionary.urls')),
37     path('raporty/', include('reporting.urls')),
38     path('info/', include('infopages.urls')),
39     path('ludzie/', include('social.urls')),
40     path('uzytkownik/', include('allauth.urls')),
41     path('czekaj/', include('waiter.urls')),
42     path('wesprzyj/', include('funding.urls')),
43     path('ankieta/', include('polls.urls')),
44     path('biblioteki/', include('libraries.urls')),
45     path('mapa/', include('references.urls')),
46     path('newsletter/', include('newsletter.urls')),
47     path('formularz/', include('forms_builder.forms.urls')),
48     path('messaging/', include('messaging.urls')),
49     path('re/', include('redirects.urls')),
50     path('stats/', include('stats.urls')),
51     path('paypal/', include('paypal.urls')),
52     path('powiadomienie/', include('push.urls')),
53     path('pomagam/', include('club.urls')),
54     path('szkola-', include('education.urls')),
55     path('towarzystwo/notify/<int:pk>/',  club.views.PayUNotifyView.as_view(), name='club_payu_notify'),
56     path('towarzystwo/', RedirectView.as_view(url='/pomagam/', permanent=False, query_string=True)),
57     path('towarzystwo/<path:path>', RedirectView.as_view(
58         url='/pomagam/%(path)s', permanent=False)),
59     path('', include('bookmarks.urls')),
60
61     path('chunks/', include('chunks.urls')),
62
63     # Admin panel
64     path('admin/catalogue/book/import', catalogue.views.import_book, name='import_book'),
65     path('admin/doc/', include('django.contrib.admindocs.urls')),
66     path('admin/', admin.site.urls),
67
68     # API
69     path('api/', include('api.urls')),
70     # OAIPMH
71     path('oaipmh/', include('oai.urls')),
72
73     path('szukaj/', include('search.urls')),
74
75     path('i18n/', include('django.conf.urls.i18n')),
76 ]
77
78 urlpatterns += [
79     # old static pages - redirected
80     path('1procent/', RedirectView.as_view(
81         url='https://fundacja.wolnelektury.pl/pomoz-nam/1-procent/', permanent=True)),
82     path('epub/', RedirectView.as_view(
83         url='/katalog/lektury/', permanent=False)),
84     path('mozesz-nam-pomoc/', RedirectView.as_view(
85         url='/info/wlacz-sie-w-prace/', permanent=True)),
86     path('o-projekcie/', RedirectView.as_view(
87         url='/info/o-projekcie/', permanent=True)),
88     path('widget/', RedirectView.as_view(
89         url='/info/widget/', permanent=True)),
90     path('wolontariat/', RedirectView.as_view(
91         url='/info/wlacz-sie-w-prace/', permanent=False)),
92 ]
93
94
95 if settings.DEBUG:
96     import debug_toolbar
97     urlpatterns = [
98         path('__debug__/', include(debug_toolbar.urls)),
99     ] + urlpatterns
100
101 if settings.DEBUG:
102     import functools
103     from django.views.defaults import page_not_found, server_error
104     urlpatterns += [
105         path('error/500/', server_error),
106         path('error/404/', functools.partial(page_not_found, exception=None)),
107
108         # Static files
109         path('%s<path:path>' % settings.MEDIA_URL[1:], django.views.static.serve,
110            {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
111     ]