summaryrefslogtreecommitdiff
path: root/base_urls.py
blob: 8a3c9707a1289168ad75966dbf9c05fab10889b9 (plain)
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
from django.conf.urls.defaults import *
from django.contrib import admin
from django.views.generic import list_detail
from django.views.generic.simple import redirect_to,direct_to_template
from django.contrib.sitemaps import FlatPageSitemap
from django.conf import settings

from blog.models import BlogSitemap,LatestFull
from locations.models import WritingbyLocationSitemap
from links.models import LatestLinks

admin.autodiscover()


sitemaps = {
    'blog': BlogSitemap,
    'flatpages': FlatPageSitemap,
    #'locations': WritingbyLocationSitemap
}
feeds = {
    'writing': LatestFull,
    'fblinks' : LatestLinks,
}

if settings.DEVELOPMENT:
    urlpatterns = patterns('',
    (r'^media/admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT+'/admin'}),
     (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
     (r'^images/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.IMAGES_ROOT}),
    )
else:
    urlpatterns = patterns('')

# old page redirects
urlpatterns += patterns('',
    (r'^2003/nov/02/take-me-your-leader-ii/$', direct_to_template, {'template': 'static/oldcontent.html'}),
    (r'^2003/aug/07/take-me-your-leader/$', direct_to_template, {'template': 'static/oldcontent.html'}),
    (r'^2004/jan/07/david-foster-wallace-infinity/$', direct_to_template, {'template': 'static/oldcontent.html'}),
)

urlpatterns += patterns('',
    (r'^colophon/', redirect_to, {'url': '/about/'}),
    (r'^admin/doc/', redirect_to, {'url': '/grappelli/help/1/'}),
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
	(r'^admin/filebrowser/', include('filebrowser.urls')),
    (r'^admin/(.*)', admin.site.root),   
    (r'^grappelli/', include('grappelli.urls')),
    (r'^uploads/', include('upload.urls')),
    (r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}),
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    (r'^admin/(.*)', admin.site.root),
    (r'^robots.txt$', direct_to_template, {'template': 'archives/robots.html'}),
    (r'^googleb11655cd59dacf3c.html$', direct_to_template, {'template': 'static/gverify.html'}),
    (r'^contact/', include('contact_form.urls')),
    #(r'^photo-of-the-day/$', 'luxagraf.photos.views.potd_list'),
    (r'^sitemap.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
    (r'^writing/', include('blog.urls')),
    (r'^projects/', include('projects.urls')),
    (r'^tops/', include('blog.urls')),
    (r'^topics/(?P<slug>[-\w]+)/$', redirect_to, {'url': '/topics/%(slug)s/1/'}),
    (r'^topics/(?P<slug>[-\w]+)/(?P<page>\d+)/', 'blog.views.topic_list'),
    #Entry detail i.e. /year/month/day/my-title/
	(r'(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', 'blog.views.entry_detail'),
    # locations
    (r'^locations/', include('locations.urls')),
    (r'^photos/', include('photos.urls')),
    (r'^photo/', include('photos.detail_urls')),
    # map
    (r'^map/', include('locations.urls')),
    #about
    (r'^about/$', 'blog.views.about'), #'blog.views.home'),
    #homepage
    (r'^$', 'blog.views.home'), #'blog.views.home'),
)