|
1 | 1 | from django.conf.urls import include
|
2 |
| -from django.conf.urls import url |
| 2 | +from django.conf.urls import re_path |
3 | 3 | from django.http import HttpResponse
|
4 | 4 | from django.shortcuts import redirect
|
5 | 5 | from django.urls import reverse
|
|
27 | 27 |
|
28 | 28 | urlpatterns = [
|
29 | 29 | # test pages
|
30 |
| - url(r'^test/status$', lambda _: HttpResponse('ok'), name='status'), |
31 |
| - url(r'^test/session$', test_session, name='test_session'), |
32 |
| - url(r'^test/periodic$', test_list_periodic_functions, name='test_list_periodic_functions'), |
| 30 | + re_path(r'^test/status$', lambda _: HttpResponse('ok'), name='status'), |
| 31 | + re_path(r'^test/session$', test_session, name='test_session'), |
| 32 | + re_path(r'^test/periodic$', test_list_periodic_functions, name='test_list_periodic_functions'), |
33 | 33 |
|
34 | 34 | # prometheus metrics
|
35 |
| - url('', include('django_prometheus.urls')), |
| 35 | + re_path('', include('django_prometheus.urls')), |
36 | 36 |
|
37 |
| - url(r'^$', home, name='home'), |
38 |
| - url(r'^robots\.txt$', robots_dot_txt, name='robots.txt'), |
39 |
| - url(r'^favicon.ico$', favicon, name='favicon'), |
40 |
| - url(r'^.well-known/security\.txt$', security_dot_txt, name='security.txt'), |
| 37 | + re_path(r'^$', home, name='home'), |
| 38 | + re_path(r'^robots\.txt$', robots_dot_txt, name='robots.txt'), |
| 39 | + re_path(r'^favicon.ico$', favicon, name='favicon'), |
| 40 | + re_path(r'^.well-known/security\.txt$', security_dot_txt, name='security.txt'), |
41 | 41 |
|
42 |
| - url(r'^staff-hours$', staff_hours, name='staff-hours'), |
| 42 | + re_path(r'^staff-hours$', staff_hours, name='staff-hours'), |
43 | 43 |
|
44 |
| - url(r'^account/', include(account)), |
45 |
| - url(r'^announcements/', include(announcements)), |
46 |
| - url(r'^docs/', include(docs)), |
47 |
| - url(r'^login/', include(login)), |
48 |
| - url(r'^stats/', include(stats)), |
49 |
| - url(r'^lab_reservations/', include(lab_reservations)), |
| 44 | + re_path(r'^account/', include(account)), |
| 45 | + re_path(r'^announcements/', include(announcements)), |
| 46 | + re_path(r'^docs/', include(docs)), |
| 47 | + re_path(r'^login/', include(login)), |
| 48 | + re_path(r'^stats/', include(stats)), |
| 49 | + re_path(r'^lab_reservations/', include(lab_reservations)), |
50 | 50 |
|
51 | 51 | # about pages
|
52 |
| - url(r'^about/staff$', about_staff, name='about-staff'), |
53 |
| - url(r'^about/lab/open-source$', lab_open_source, name='lab-open-source'), |
54 |
| - url(r'^about/lab/vote$', lab_vote, name='lab-vote'), |
55 |
| - url(r'^about/lab/survey$', lab_survey, name='lab-survey'), |
| 52 | + re_path(r'^about/staff$', about_staff, name='about-staff'), |
| 53 | + re_path(r'^about/lab/open-source$', lab_open_source, name='lab-open-source'), |
| 54 | + re_path(r'^about/lab/vote$', lab_vote, name='lab-vote'), |
| 55 | + re_path(r'^about/lab/survey$', lab_survey, name='lab-survey'), |
56 | 56 |
|
57 | 57 | # tv endpoints
|
58 |
| - url(r'^tv/', include(tv)), |
| 58 | + re_path(r'^tv/', include(tv)), |
59 | 59 |
|
60 | 60 | # API endpoints
|
61 |
| - url(r'^api/', include(api)), |
| 61 | + re_path(r'^api/', include(api)), |
62 | 62 |
|
63 | 63 | # hosting logos
|
64 |
| - url( |
| 64 | + re_path( |
65 | 65 | r'^images/hosted-logos/(?:index\.shtml)?$',
|
66 | 66 | lambda _: redirect(reverse('doc', args=('services/vhost/badges',)), permanent=True),
|
67 | 67 | ),
|
68 |
| - url(r'^images/hosted-logos/(.*)$', lambda _, image: redirect('hosting-logo', image, permanent=True)), |
69 |
| - url(r'^hosting-logos/(.*)$', hosting_logo, name='hosting-logo'), |
| 68 | + re_path(r'^images/hosted-logos/(.*)$', lambda _, image: redirect('hosting-logo', image, permanent=True)), |
| 69 | + re_path(r'^hosting-logos/(.*)$', hosting_logo, name='hosting-logo'), |
70 | 70 |
|
71 | 71 | # legacy redirects
|
72 |
| - url(r'^index\.s?html$', lambda _: redirect(reverse('home'), permanent=True)), |
73 |
| - url(r'^staff_hours(?:\.cgi)?$', lambda _: redirect(reverse('staff-hours'), permanent=True)), |
74 |
| - url(r'^staff-hours\.cgi$', lambda _: redirect(reverse('staff-hours'), permanent=True)), |
75 |
| - url(r'^OCF/(?:index\.shtml)?$', lambda _: redirect(reverse('doc', args=('about',)), permanent=True)), |
76 |
| - url( |
| 72 | + re_path(r'^index\.s?html$', lambda _: redirect(reverse('home'), permanent=True)), |
| 73 | + re_path(r'^staff_hours(?:\.cgi)?$', lambda _: redirect(reverse('staff-hours'), permanent=True)), |
| 74 | + re_path(r'^staff-hours\.cgi$', lambda _: redirect(reverse('staff-hours'), permanent=True)), |
| 75 | + re_path(r'^OCF/(?:index\.shtml)?$', lambda _: redirect(reverse('doc', args=('about',)), permanent=True)), |
| 76 | + re_path( |
77 | 77 | r'^OCF/(?:past_)?officers.shtml$',
|
78 | 78 | lambda _: redirect(reverse('doc', args=('about/officers',)), permanent=True),
|
79 | 79 | ),
|
80 |
| - url(r'^OCF/staff/(?:index\.shtml)?$', lambda _: redirect(reverse('doc', args=('staff',)), permanent=True)), |
81 |
| - url( |
| 80 | + re_path(r'^OCF/staff/(?:index\.shtml)?$', lambda _: redirect(reverse('doc', args=('staff',)), permanent=True)), |
| 81 | + re_path( |
82 | 82 | r'^OCF/staff/where-now\.shtml$',
|
83 | 83 | lambda _: redirect(reverse('doc', args=('about/formerstaff',)), permanent=True),
|
84 | 84 | ),
|
85 |
| - url(r'^OCF/policies(?:/|$)', lambda _: redirect(reverse('docs'), permanent=True)), |
86 |
| - url(r'^OCF/OCF_FAQ\.shtml$', lambda _: redirect(reverse('doc', args=('faq',)), permanent=True)), |
87 |
| - url(r'^OCF/officers_.*\.s?html$', lambda _: redirect(reverse('doc', args=('about/officers',)), permanent=True)), |
88 |
| - url(r'^OCF/staff/how-to-join\.shtml$', lambda _: redirect(reverse('about-staff'), permanent=True)), |
89 |
| - url(r'^mlk$', lambda _: redirect(reverse('doc', args=('services/lab',)), permanent=True)), |
| 85 | + re_path(r'^OCF/policies(?:/|$)', lambda _: redirect(reverse('docs'), permanent=True)), |
| 86 | + re_path(r'^OCF/OCF_FAQ\.shtml$', lambda _: redirect(reverse('doc', args=('faq',)), permanent=True)), |
| 87 | + re_path(r'^OCF/officers_.*\.s?html$', lambda _: redirect(reverse('doc', args=('about/officers',)), permanent=True)), |
| 88 | + re_path(r'^OCF/staff/how-to-join\.shtml$', lambda _: redirect(reverse('about-staff'), permanent=True)), |
| 89 | + re_path(r'^mlk$', lambda _: redirect(reverse('doc', args=('services/lab',)), permanent=True)), |
90 | 90 | ]
|
0 commit comments