Merge branch 'bump-ver' into 'master'
[mailman-postorious.git] / example_project / urls.py
blob566cab8ef11a020f20b761cfc207e3efd32581b7
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 1998-2022 by the Free Software Foundation, Inc.
4 # This file is part of Postorius.
6 # Postorius is free software: you can redistribute it and/or modify it under
7 # the terms of the GNU General Public License as published by the Free
8 # Software Foundation, either version 3 of the License, or (at your option)
9 # any later version.
11 # Postorius is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Postorius. If not, see <http://www.gnu.org/licenses/>.
20 from django.conf import settings
21 from django.contrib import admin
22 from django.http import Http404
23 from django.urls import include, path, re_path, reverse_lazy
24 from django.views.defaults import server_error
25 from django.views.generic import RedirectView
28 def not_found(request):
29 """A test view to return 404 error to test 400.html"""
30 raise Http404('Page not Found.')
33 urlpatterns = [
34 re_path(
35 r'^$',
36 RedirectView.as_view(url=reverse_lazy('list_index'), permanent=True),
38 re_path(r'^postorius/', include('postorius.urls')),
39 re_path(r'', include('django_mailman3.urls')),
40 re_path(r'^accounts/', include('allauth.urls')),
41 # Add some testing routes to test 400/500 error pages without having to
42 # introduce errors.
43 re_path(r'500/$', server_error),
44 re_path(r'400/$', not_found),
45 # Django admin
46 re_path(r'^admin/', admin.site.urls),
50 if settings.DEBUG:
51 import debug_toolbar
53 urlpatterns = [
54 path('__debug__/', include(debug_toolbar.urls)),
55 ] + urlpatterns