forked from archlinux/archweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
128 lines (112 loc) · 5.12 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
118
119
120
121
122
123
124
125
126
127
128
from django.conf.urls import url
from django.urls import include, path
from django.contrib import admin
from django.contrib.sitemaps import views as sitemap_views
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from feeds import PackageFeed, NewsFeed, ReleaseFeed, PackageUpdatesFeed, PlanetFeed
import sitemaps
import devel.urls
import mirrors.urls
import mirrors.urls_mirrorlist
import news.urls
import packages.urls
import packages.urls_groups
import planet.views
import public.views
import releng.urls
import todolists.urls
import visualize.urls
our_sitemaps = {
'base': sitemaps.BaseSitemap,
'news': sitemaps.NewsSitemap,
'packages': sitemaps.PackagesSitemap,
'package-files': sitemaps.PackageFilesSitemap,
'package-groups': sitemaps.PackageGroupsSitemap,
'split-packages': sitemaps.SplitPackagesSitemap,
'releases': sitemaps.ReleasesSitemap,
'todolists': sitemaps.TodolistSitemap,
}
news_sitemaps = {'news': sitemaps.RecentNewsSitemap}
urlpatterns = []
# Public pages
urlpatterns.extend([
url(r'^$', public.views.index, name='index'),
url(r'^about/$', TemplateView.as_view(template_name='public/about.html'), name='page-about'),
url(r'^art/$', TemplateView.as_view(template_name='public/art.html'), name='page-art'),
url(r'^svn/$', TemplateView.as_view(template_name='public/svn.html'), name='page-svn'),
url(r'^donate/$', public.views.donate, name='page-donate'),
url(r'^download/$', public.views.download, name='page-download'),
url(r'^master-keys/$', public.views.keys, name='page-keys'),
url(r'^master-keys/json/$', public.views.keys_json, name='pgp-keys-json'),
url(r'^people/(?P<slug>[-\w]+)/$', public.views.people, name='people'),
url(r'^planet/$', planet.views.index, name='planet'),
])
# Feeds patterns, used below
feeds_patterns = [
url(r'^$', public.views.feeds, name='feeds-list'),
url(r'^news/$', cache_page(311)(NewsFeed())),
url(r'^packages/$', cache_page(313)(PackageFeed())),
url(r'^packages/(added|removed)/$', cache_page(313)(PackageUpdatesFeed())),
url(r'^packages/(added|removed)/(?P<arch>[A-z0-9]+)/$', cache_page(313)(PackageUpdatesFeed())),
url(r'^packages/(added|removed)/all/(?P<repo>[A-z0-9\-]+)/$', cache_page(313)(PackageUpdatesFeed())),
url(r'^packages/(added|removed)/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$',
cache_page(313)(PackageUpdatesFeed())),
url(r'^packages/(?P<arch>[A-z0-9]+)/$', cache_page(313)(PackageFeed())),
url(r'^packages/all/(?P<repo>[A-z0-9\-]+)/$', cache_page(313)(PackageFeed())),
url(r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$', cache_page(313)(PackageFeed())),
url(r'^releases/$', cache_page(317)(ReleaseFeed())),
url(r'^planet/$', cache_page(317)(PlanetFeed()), name='planet-feed'),
]
# Old planet.archlinux.org redirects, to be removed once people have migrated.
urlpatterns.extend([
url(r'^planet/rss20.xml$', cache_page(317)(PlanetFeed())),
url(r'^planet/atom.xml$', cache_page(317)(PlanetFeed())),
])
# Includes and other remaining stuff
urlpatterns.extend([
url(r'^admin/', admin.site.urls),
url(r'^devel/', include(devel.urls)),
url(r'^feeds/', include(feeds_patterns)),
url(r'^groups/', include(packages.urls_groups)),
url(r'^mirrorlist/', include(mirrors.urls_mirrorlist)),
url(r'^mirrors/', include(mirrors.urls)),
url(r'^news/', include(news.urls)),
url(r'^packages/', include(packages.urls)),
url(r'^releng/', include(releng.urls)),
url(r'^todo/', include(todolists.urls)),
url(r'^visualize/', include(visualize.urls)),
url(r'^opensearch/packages/$', packages.views.opensearch, name='opensearch-packages'),
url(r'^opensearch/packages/suggest$', packages.views.opensearch_suggest, name='opensearch-packages-suggest'),
])
# Sitemaps
urlpatterns.extend([
url(r'^sitemap.xml$', cache_page(1831)(sitemap_views.index),
{'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}),
url(r'^sitemap-(?P<section>.+)\.xml$', cache_page(1831)(sitemap_views.sitemap),
{'sitemaps': our_sitemaps, 'template_name': 'sitemaps/sitemap.xml'},
name='sitemaps'),
url(r'^news-sitemap\.xml$', cache_page(1831)(sitemap_views.sitemap),
{'sitemaps': news_sitemaps, 'template_name': 'sitemaps/news_sitemap.xml'},
name='news-sitemap'),
])
# Authentication
urlpatterns.extend([
url(r'^login/$', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'),
url(r'^logout/$', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'),
])
# django-toolbar
if settings.DEBUG_TOOLBAR:
import debug_toolbar
urlpatterns.extend([
path('__debug__/', include(debug_toolbar.urls)),
])
# displays all archweb urls
def show_urls(urllist=urlpatterns, depth=0): # pragma: no cover
for entry in urllist:
print(" " * depth, entry.regex.pattern)
if hasattr(entry, 'url_patterns'):
show_urls(entry.url_patterns, depth + 1)
# vim: set ts=4 sw=4 et: