This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 678
/
urls.py
117 lines (103 loc) · 3.07 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.views.static import serve
from django.views.generic import RedirectView
from kuma.attachments import views as attachment_views
from kuma.core import views as core_views
from kuma.wiki.admin import purge_view
from kuma.wiki.views.legacy import mindtouch_to_kuma_redirect
admin.autodiscover()
handler403 = core_views.handler403
handler404 = core_views.handler404
handler500 = core_views.handler500
urlpatterns = [
url('', include('kuma.health.urls')),
url('', include('kuma.landing.urls')),
url(
r'^events',
RedirectView.as_view(
url='https://mozilla.org/contribute/events',
permanent=False
),
name='events'
),
]
if settings.MAINTENANCE_MODE:
urlpatterns.append(
url(
r'^admin/.*',
RedirectView.as_view(
pattern_name='maintenance_mode',
permanent=False
)
)
)
else:
urlpatterns += [
# Django admin:
url(r'^admin/wiki/document/purge/',
purge_view,
name='wiki.admin_bulk_purge'),
url(r'^admin/', include(admin.site.urls)),
]
urlpatterns += [
url(r'^search', include('kuma.search.urls')),
url(r'^docs', include('kuma.wiki.urls')),
url('', include('kuma.attachments.urls')),
url('', include('kuma.dashboards.urls')),
url('', include('kuma.users.urls')),
]
if settings.MAINTENANCE_MODE:
urlpatterns.append(
# Redirect if we try to use the "tidings" unsubscribe.
url(
r'^unsubscribe/.*',
RedirectView.as_view(
pattern_name='maintenance_mode',
permanent=False
)
)
)
else:
urlpatterns.append(
url(r'^', include('tidings.urls')),
)
urlpatterns += [
# Services and sundry.
url(r'^humans.txt$',
serve,
{'document_root': settings.HUMANSTXT_ROOT, 'path': 'humans.txt'}),
url(r'^miel$',
handler500,
name='users.honeypot'),
]
if settings.SERVE_MEDIA:
media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
urlpatterns += [
url(r'^%s/(?P<path>.*)$' % media_url,
serve,
{'document_root': settings.MEDIA_ROOT}),
]
if settings.SERVE_LEGACY and settings.LEGACY_ROOT:
urlpatterns.append(
url(
r'^(?P<path>(diagrams|presentations|samples)/.+)$',
serve,
{'document_root': settings.LEGACY_ROOT}
)
)
if getattr(settings, 'DEBUG_TOOLBAR_INSTALLED', False):
import debug_toolbar
urlpatterns.append(
url(r'^__debug__/', include(debug_toolbar.urls)),
)
# Legacy MindTouch redirects. These go last so that they don't mess
# with local instances' ability to serve media.
urlpatterns += [
url(r'^@api/deki/files/(?P<file_id>\d+)/=(?P<filename>.+)$',
attachment_views.mindtouch_file_redirect,
name='attachments.mindtouch_file_redirect'),
url(r'^(?P<path>.*)$',
mindtouch_to_kuma_redirect),
]