From 6687120a3e0f0b7bfa148e93eb65bb2d2aa383d0 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sat, 7 May 2011 14:21:23 -0400 Subject: updated url schema, frontpage template --- piccast/settings.py.example | 1 + piccast/urls.py | 26 ++++++++++++++++++++------ www/frontpage.html | 9 +++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 www/frontpage.html diff --git a/piccast/settings.py.example b/piccast/settings.py.example index 23118be..71ef664 100644 --- a/piccast/settings.py.example +++ b/piccast/settings.py.example @@ -70,6 +70,7 @@ TEMPLATE_DIRS = ( # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. './templates', + '../www', ) INSTALLED_APPS = ( diff --git a/piccast/urls.py b/piccast/urls.py index 51ba2d6..aa2361f 100644 --- a/piccast/urls.py +++ b/piccast/urls.py @@ -1,6 +1,7 @@ from django.conf.urls.defaults import * from django.contrib import databrowse from piccast.feeds.models import * +from django.views.generic.simple import redirect_to, direct_to_template # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -16,14 +17,27 @@ urlpatterns = patterns('', (r'^admin/', include(admin.site.urls)), (r'^browse/(.*)', databrowse.site.root), - # not using this subdirectory scheme; I like to have it all at the toplevel + # Not using the subdirectory scheme; I like to have it all at the toplevel # (r'^piccast/', include('piccast.foo.urls')), - (r'^json/feeds/', 'feeds.views.newest_feeds'), - (r'^json/pics_by_set/(\d+)/', 'feeds.views.pics_by_set'), - (r'^json/sets_by_feed/(\d+)/', 'feeds.views.sets_by_feed'), - (r'^json/sets_by_feed/([-\w]+)/', 'feeds.views.sets_by_feedslug'), + (r'^json/v0/feeds/', 'feeds.views.newest_feeds'), + (r'^json/v0/pics_by_set/(\d+)/', 'feeds.views.pics_by_set'), + (r'^json/v0/sets_by_feed/(\d+)/', 'feeds.views.sets_by_feed'), + (r'^json/v0/sets_by_feed/([-\w]+)/', 'feeds.views.sets_by_feedslug'), + (r'^json/v0/search', 'feeds.views.json_search'), + (r'^basic$', 'feeds.views.basic_frontpage'), + (r'^$', direct_to_template, {'template': 'frontpage.html'}), + + # for backwards compatability + (r'^json/feeds/', + redirect_to, {'url':'/json/v0/feeds/', 'permanent': False}), + (r'^json/pics_by_set/(?P\d+)/', + redirect_to, {'url':'/json/v0/pics_by_set/%(id)s/', 'permanent': False}), + (r'^json/sets_by_feed/(?P\d+)/', + redirect_to, {'url':'/json/v0/sets_by_feed/%(id)s/', 'permanent': False}), + (r'^json/sets_by_feed/(?P[-\w]+)/', + redirect_to, {'url':'/json/v0/sets_by_feed/%(slug)s/', 'permanent': False}), + # BUG: this doesn't redirect correctly with the query info, so just serving it (r'^json/search', 'feeds.views.json_search'), - (r'^$', 'feeds.views.basic_frontpage'), ) diff --git a/www/frontpage.html b/www/frontpage.html new file mode 100644 index 0000000..4e56801 --- /dev/null +++ b/www/frontpage.html @@ -0,0 +1,9 @@ + +piccastapp.com + +
+
 
+    PicCast 
+
+ -- cgit v1.2.3