summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-01-21 11:08:35 -0600
committerDan McGee <dan@archlinux.org>2013-01-21 11:08:35 -0600
commita15d0850af0f766cd895b863f62524f1a1b2fe05 (patch)
tree3263cfc6feed8c64aab64ada5eb19045bdd7f01e
parent53484c45ea82a5afa8bf167f978f657b866d4c93 (diff)
Slight reorganization of urls.py
Move some of the not-so-frequently used resources further down in the list of URLs, which will ever so slightly speed up the resolver. Sitemaps don't need to be checked near as often, for instance. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--urls.py77
1 files changed, 43 insertions, 34 deletions
diff --git a/urls.py b/urls.py
index 82882970..97b84a36 100644
--- a/urls.py
+++ b/urls.py
@@ -21,38 +21,6 @@ our_sitemaps = {
admin.autodiscover()
urlpatterns = []
-# Feeds patterns, used later
-feeds_patterns = patterns('',
- (r'^$', 'public.views.feeds', {}, 'feeds-list'),
- (r'^news/$', cache_page(300)(NewsFeed())),
- (r'^packages/$', cache_page(300)(PackageFeed())),
- (r'^packages/(?P<arch>[A-z0-9]+)/$',
- cache_page(300)(PackageFeed())),
- (r'^packages/all/(?P<repo>[A-z0-9\-]+)/$',
- cache_page(300)(PackageFeed())),
- (r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$',
- cache_page(300)(PackageFeed())),
- (r'^releases/$', cache_page(300)(ReleaseFeed())),
-)
-
-# Sitemaps
-urlpatterns += patterns('',
- (r'^sitemap.xml$',
- cache_page(1800)(sitemap_views.index),
- {'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}),
- (r'^sitemap-(?P<section>.+)\.xml$',
- cache_page(1800)(sitemap_views.sitemap),
- {'sitemaps': our_sitemaps}, 'sitemaps'),
-)
-
-# Authentication / Admin
-urlpatterns += patterns('django.contrib.auth.views',
- (r'^login/$', 'login', {
- 'template_name': 'registration/login.html'}),
- (r'^logout/$', 'logout', {
- 'template_name': 'registration/logout.html'}),
-)
-
# Public pages
urlpatterns += patterns('public.views',
(r'^$', 'index', {}, 'index'),
@@ -71,8 +39,18 @@ urlpatterns += patterns('public.views',
(r'^master-keys/json/$', 'keys_json', {}, 'pgp-keys-json'),
)
-urlpatterns += patterns('retro.views',
- (r'^retro/(?P<year>[0-9]{4})/$', 'retro_homepage', {}, 'retro-homepage'),
+# Feeds patterns, used below
+feeds_patterns = patterns('',
+ (r'^$', 'public.views.feeds', {}, 'feeds-list'),
+ (r'^news/$', cache_page(300)(NewsFeed())),
+ (r'^packages/$', cache_page(300)(PackageFeed())),
+ (r'^packages/(?P<arch>[A-z0-9]+)/$',
+ cache_page(300)(PackageFeed())),
+ (r'^packages/all/(?P<repo>[A-z0-9\-]+)/$',
+ cache_page(300)(PackageFeed())),
+ (r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$',
+ cache_page(300)(PackageFeed())),
+ (r'^releases/$', cache_page(300)(ReleaseFeed())),
)
# Includes and other remaining stuff
@@ -97,6 +75,30 @@ urlpatterns += patterns('',
(r'^todolists/$','todolists.views.public_list'),
)
+# Retro home page views
+urlpatterns += patterns('retro.views',
+ (r'^retro/(?P<year>[0-9]{4})/$', 'retro_homepage', {}, 'retro-homepage'),
+)
+
+# Sitemaps
+urlpatterns += patterns('',
+ (r'^sitemap.xml$',
+ cache_page(1800)(sitemap_views.index),
+ {'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}),
+ (r'^sitemap-(?P<section>.+)\.xml$',
+ cache_page(1800)(sitemap_views.sitemap),
+ {'sitemaps': our_sitemaps}, 'sitemaps'),
+)
+
+# Authentication / Admin
+urlpatterns += patterns('django.contrib.auth.views',
+ (r'^login/$', 'login', {
+ 'template_name': 'registration/login.html'}),
+ (r'^logout/$', 'logout', {
+ 'template_name': 'registration/logout.html'}),
+)
+
+# Redirects for older known pages we see in the logs
legacy_urls = (
('^about.php', '/about/'),
('^changelog.php', '/packages/?sort=-last_update'),
@@ -120,4 +122,11 @@ legacy_urls = (
urlpatterns += [url(old_url, RedirectView.as_view(url=new_url))
for old_url, new_url in legacy_urls]
+
+def show_urls(urllist=urlpatterns, depth=0):
+ 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: