cablegates/pandora/urls.py

55 lines
1.9 KiB
Python
Raw Normal View History

2010-09-15 18:25:54 +02:00
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
2009-06-08 18:08:59 +02:00
from django.conf.urls.defaults import *
from ox.django.http import HttpFileResponse
2009-06-08 18:08:59 +02:00
2009-08-16 14:23:29 +02:00
from django.conf import settings
2009-06-08 18:08:59 +02:00
# Uncomment the next two lines to enable the admin:
2009-08-16 14:23:29 +02:00
from django.contrib import admin
admin.autodiscover()
2010-12-22 20:47:38 +05:30
from api import actions
actions.autodiscover()
2010-11-25 16:21:23 +01:00
2010-09-15 18:25:54 +02:00
def serve_static_file(path, location, content_type):
return HttpFileResponse(location, content_type=content_type)
2009-06-08 18:08:59 +02:00
urlpatterns = patterns('',
2010-11-25 16:21:23 +01:00
(r'^admin/', include(admin.site.urls)),
2009-12-31 16:04:32 +01:00
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
2010-08-07 16:31:20 +02:00
(r'^api/upload/$', 'archive.views.firefogg_upload'),
(r'^timeline$', 'app.views.timeline'),
2010-09-14 16:10:37 +02:00
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'),
2010-11-08 17:34:25 +01:00
(r'^api/$', include('api.urls')),
(r'', include('item.urls')),
2010-09-15 18:25:54 +02:00
(r'^robots.txt$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'robots.txt'), 'content_type': 'text/plain'}),
2010-09-15 18:40:39 +02:00
(r'^favicon.ico$', serve_static_file, {'location': os.path.join(settings.STATIC_ROOT, 'png/icon.16.png'), 'content_type': 'image/x-icon'}),
2009-06-08 18:08:59 +02:00
)
2009-08-16 14:23:29 +02:00
if settings.DEBUG:
urlpatterns += patterns('',
2010-11-06 17:14:40 +01:00
(r'^data/(?P<path>.*)$', 'django.views.static.serve',
2009-08-16 14:23:29 +02:00
{'document_root': settings.MEDIA_ROOT}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT}),
(r'^tests/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.TESTS_ROOT}),
2009-08-16 14:23:29 +02:00
)
2011-01-04 11:33:00 +05:30
2011-02-22 22:22:03 +05:30
urlpatterns += patterns('',
(r'^(V[a-z0-9]*)$', 'urlalias.views.padma_video'),
(r'^(V[a-z0-9]*/.*)$', 'urlalias.views.padma_video'),
)
2010-11-29 02:08:21 +01:00
urlpatterns += patterns('',
2011-01-04 11:33:00 +05:30
(r'^.*?embed$', 'app.views.embed'),
2010-11-30 22:03:37 +01:00
(r'^[A-Z0-9].*$', 'app.views.index'),
2011-01-21 19:10:42 +00:00
(r'^[a-z0-9].+$', 'app.views.index'),
2010-12-01 00:40:31 +01:00
(r'^$', 'app.views.index'),
2010-11-29 02:08:21 +01:00
)
2009-08-16 14:23:29 +02:00
2010-12-07 20:10:16 +01:00
urlpatterns += patterns('django.views.generic.simple',
2010-12-07 19:56:12 +01:00
('^ra$', 'redirect_to', {'url': '/'}),
)