diff options
Diffstat (limited to 'urls.py')
-rw-r--r-- | urls.py | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -1,20 +1,24 @@ import os.path -from django.conf.urls.defaults import * +# Stupid Django. Don't remove these "unused" handler imports +from django.conf.urls.defaults import handler500, handler404, include, patterns from django.conf import settings from django.contrib import admin from django.views.generic import TemplateView +from django.views.decorators.cache import cache_page +from django.views.i18n import null_javascript_catalog from feeds import PackageFeed, NewsFeed import sitemaps -sitemaps = { +our_sitemaps = { 'base': sitemaps.BaseSitemap, 'news': sitemaps.NewsSitemap, 'packages': sitemaps.PackagesSitemap, 'package-files': sitemaps.PackageFilesSitemap, 'package-groups': sitemaps.PackageGroupsSitemap, + 'split-packages': sitemaps.SplitPackagesSitemap, } admin.autodiscover() @@ -33,10 +37,12 @@ feeds_patterns = patterns('', # Sitemaps urlpatterns += patterns('django.contrib.sitemaps.views', + # Thanks Django, we can't cache these longer because of + # https://code.djangoproject.com/ticket/2713 (r'^sitemap.xml$', 'index', - {'sitemaps': sitemaps}), + {'sitemaps': our_sitemaps}), (r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', - {'sitemaps': sitemaps}), + {'sitemaps': our_sitemaps}), ) # Authentication / Admin @@ -58,15 +64,16 @@ urlpatterns += patterns('public.views', {}, 'page-art'), (r'^svn/$', TemplateView.as_view(template_name='public/svn.html'), {}, 'page-svn'), - (r'^hackers/$', 'userlist', { 'type':'hackers' }, 'page-devs'), - (r'^fellows/$', 'userlist', { 'type':'fellows' }, 'page-fellows'), + (r'^hackers/$', 'userlist', { 'user_type':'hackers' }, 'page-devs'), + (r'^fellows/$', 'userlist', { 'user_type':'fellows' }, 'page-fellows'), (r'^donate/$', 'donate', {}, 'page-donate'), (r'^download/$', 'download', {}, 'page-download'), ) # Includes and other remaining stuff urlpatterns += patterns('', - (r'^jsi18n/$', 'django.views.i18n.null_javascript_catalog'), + # cache this static JS resource for 1 week rather than default 5 minutes + (r'^jsi18n/$', cache_page(604800)(null_javascript_catalog)), (r'^admin/', include(admin.site.urls)), (r'^devel/', include('devel.urls')), (r'^feeds/', include(feeds_patterns)), |