addons-server/urls.py

39 строки
1.0 KiB
Python
Исходник Обычный вид История

2009-10-21 06:20:38 +04:00
from django.conf import settings
2009-10-23 03:43:38 +04:00
from django.conf.urls.defaults import patterns, url, include
2010-01-02 00:32:21 +03:00
from django.contrib import admin
from django.shortcuts import redirect
2010-01-02 00:32:21 +03:00
admin.autodiscover()
2009-10-23 03:43:38 +04:00
2009-10-21 03:29:27 +04:00
urlpatterns = patterns('',
2009-10-22 01:56:43 +04:00
url('^$', 'jingo.views.direct_to_template',
{'template': 'base.html'}, name='home'),
2009-10-23 03:43:38 +04:00
2010-01-27 23:15:17 +03:00
# Add-ons.
('', include('addons.urls')),
# Users
('^users/', include('users.urls')),
2009-10-21 06:20:38 +04:00
2009-12-31 01:26:56 +03:00
# AMO admin (not django admin).
('^admin/', include('admin.urls')),
2010-02-04 05:19:47 +03:00
# Nick's special pages.
('^nickspages/', include('nick.urls')),
# Redirect patterns.
('^reviews/display/(\d+)',
lambda r, id: redirect('reviews.list', id)),
# Services
('^services/', include('amo.urls')),
)
2009-10-23 03:43:38 +04:00
2009-10-21 06:20:38 +04:00
if settings.DEBUG:
# Remove leading and trailing slashes so the regex matches.
media_url = settings.MEDIA_URL.lstrip('/').rstrip('/')
urlpatterns += patterns('',
(r'^%s/(?P<path>.*)$' % media_url, 'django.views.static.serve',
2009-10-22 01:56:43 +04:00
{'document_root': settings.MEDIA_ROOT}),
2009-10-21 06:20:38 +04:00
)