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
|
2010-01-27 23:24:35 +03:00
|
|
|
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')),
|
|
|
|
|
2009-12-14 23:34:11 +03:00
|
|
|
# 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-01-27 23:24:35 +03:00
|
|
|
|
2010-02-04 05:19:47 +03:00
|
|
|
# Nick's special pages.
|
|
|
|
('^nickspages/', include('nick.urls')),
|
|
|
|
|
2010-01-27 23:24:35 +03:00
|
|
|
# Redirect patterns.
|
|
|
|
('^reviews/display/(\d+)',
|
|
|
|
lambda r, id: redirect('reviews.list', id)),
|
2010-02-05 02:14:16 +03:00
|
|
|
|
|
|
|
# Services
|
|
|
|
('^services/', include('amo.urls')),
|
2009-12-03 01:07:36 +03:00
|
|
|
)
|
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
|
|
|
)
|