| jmoiron@22 | 1 | #!/usr/bin/env python |
| jmoiron@22 | 2 | |
| jmoiron@37 | 3 | """jmoiron.net's master urls.py |
| jmoiron@22 | 4 | |
| jmoiron@37 | 5 | Implicit in my website are the fact that the following flatpages will exist |
| jmoiron@37 | 6 | and that the FlatpageFallbackMiddleware is installed and working properly: |
| jmoiron@37 | 7 | /about/ -- the classic 'about' page |
| jmoiron@37 | 8 | /code/ -- my overview of code |
| jmoiron@37 | 9 | /docs/ -- my overview of various documentation |
| jmoiron@37 | 10 | /gallery/ *** temporary static page for gallery app *** |
| jmoiron@37 | 11 | |
| jmoiron@37 | 12 | If FlatPage objects are not showing up, you might want to check the SITE_ID |
| jmoiron@37 | 13 | in settings.py/local_settings.py. |
| jmoiron@37 | 14 | |
| jmoiron@37 | 15 | The following redirects have to be made to keep old links working: |
| jmoiron@37 | 16 | /rant/?id=# |
| jmoiron@37 | 17 | /links/ |
| jmoiron@37 | 18 | /images/... |
| jmoiron@37 | 19 | """ |
| jmoiron@37 | 20 | |
| jmoiron@22 | 21 | from django.contrib import admin |
| jmoiron@37 | 22 | from django.conf import settings |
| jmoiron@79 | 23 | from django.conf.urls.defaults import include, handler500, handler404 |
| jmoiron@37 | 24 | |
| jmoiron@0 | 25 | from saudade.common.shortcuts import generics |
| jmoiron@0 | 26 | from saudade.blog.feeds import BlogFeed |
| jmoiron@127 | 27 | from saudade.comments.feeds import CommentFeed, CommentLogFeed |
| jmoiron@131 | 28 | import dselector |
| jmoiron@0 | 29 | |
| jmoiron@0 | 30 | feeds = { |
| jmoiron@0 | 31 | 'blog' : BlogFeed, |
| jmoiron@127 | 32 | 'comments' : CommentFeed, |
| jmoiron@127 | 33 | 'comments/log' : CommentLogFeed, |
| jmoiron@0 | 34 | } |
| jmoiron@22 | 35 | |
| jmoiron@22 | 36 | admin.autodiscover() |
| jmoiron@0 | 37 | |
| jmoiron@37 | 38 | images = '/media/legacy/images/' |
| jmoiron@37 | 39 | media = lambda x: '/media/' + x |
| jmoiron@0 | 40 | |
| jmoiron@37 | 41 | |
| jmoiron@131 | 42 | parser = dselector.Parser() |
| jmoiron@37 | 43 | urlpatterns = parser.patterns('', |
| jmoiron@37 | 44 | (r'rss/{url:any}/', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}), |
| jmoiron@37 | 45 | (r'admin/(.*)!', admin.site.root), |
| jmoiron@37 | 46 | (r'login/!', 'saudade.common.views.login_view'), |
| jmoiron@37 | 47 | (r'logout/!', 'saudade.common.views.logout_view'), |
| jmoiron@37 | 48 | (r'tags/!', include('saudade.tagging.urls')), |
| jmoiron@37 | 49 | (r'blog/!', include('saudade.blog.urls')), |
| jmoiron@37 | 50 | (r'todo/!', include('saudade.todo.urls')), |
| jmoiron@82 | 51 | (r'womfa/!', include('saudade.womfa.urls')), |
| jmoiron@39 | 52 | (r'linkpost/!', include('saudade.linkpost.urls')), |
| jmoiron@101 | 53 | (r'comments/!', include('saudade.comments.urls')), |
| jmoiron@200 | 54 | (r'', 'saudade.stream.views.stream'), |
| jmoiron@200 | 55 | #(r'', generics.redirect, {'url': '/blog/'}), |
| jmoiron@37 | 56 | (r'links?/!', generics.redirect, {'url': '/about/'}), |
| jmoiron@37 | 57 | (r'rant/', 'saudade.blog.views.legacy_blog'), |
| jmoiron@37 | 58 | (r'images/', generics.redirect, {'url': images}), |
| jmoiron@37 | 59 | (r'images/{arg:any}/', generics.redirect, {'url': images + '%(arg)s'}), |
| jmoiron@190 | 60 | (r'misc/argot-demo/!', include('argotdemo.urls')), |
| jmoiron@37 | 61 | # static stuff |
| jmoiron@37 | 62 | (r'robots.txt', generics.redirect, {'url': media('robots.txt')}), |
| jmoiron@37 | 63 | (r'favicon.ico', generics.redirect, {'url': media('favicon.ico')}), |
| jmoiron@37 | 64 | (r'favicon.gif', generics.redirect, {'url': media('favicon.gif')}), |
| jmoiron@37 | 65 | (r'favicon.png', generics.redirect, {'url': media('favicon.png')}), |
| jmoiron@0 | 66 | ) |
| jmoiron@0 | 67 | |
| jmoiron@0 | 68 | if settings.DEBUG: |
| jmoiron@38 | 69 | urlpatterns += parser.patterns('', |
| jmoiron@38 | 70 | (r'media/{path:any}', 'django.views.static.serve', {'document_root': './media/'}), |
| jmoiron@0 | 71 | ) |
| jmoiron@0 | 72 |
|