2012-05-02 22:22:24 +04:00
|
|
|
from django.conf import settings
|
2012-09-08 03:10:39 +04:00
|
|
|
from django.conf.urls import include, patterns, url
|
2012-02-24 21:55:04 +04:00
|
|
|
from django.contrib import admin
|
2012-04-04 20:22:40 +04:00
|
|
|
from django.shortcuts import redirect
|
2012-02-22 08:44:51 +04:00
|
|
|
from django.views.decorators.cache import cache_page
|
|
|
|
from django.views.i18n import javascript_catalog
|
2012-02-04 04:56:25 +04:00
|
|
|
|
2012-05-02 22:14:31 +04:00
|
|
|
import amo
|
2012-02-22 08:44:51 +04:00
|
|
|
from apps.users.views import logout
|
2012-04-04 20:22:40 +04:00
|
|
|
from apps.users.urls import (detail_patterns as user_detail_patterns,
|
|
|
|
users_patterns as users_users_patterns)
|
2012-09-10 22:23:40 +04:00
|
|
|
from mkt.account.urls import (purchases_patterns, settings_patterns,
|
2012-04-04 20:22:40 +04:00
|
|
|
users_patterns as mkt_users_patterns)
|
2012-08-15 22:39:36 +04:00
|
|
|
from mkt.developers.views import login
|
2012-07-25 22:23:42 +04:00
|
|
|
from mkt.purchase.urls import bluevia_services_patterns
|
2012-06-29 03:50:58 +04:00
|
|
|
from mkt.themes.urls import theme_patterns
|
2012-02-22 08:44:51 +04:00
|
|
|
|
2012-02-24 21:55:04 +04:00
|
|
|
admin.autodiscover()
|
|
|
|
|
2012-02-18 16:52:12 +04:00
|
|
|
handler404 = 'mkt.site.views.handler404'
|
|
|
|
handler500 = 'mkt.site.views.handler500'
|
|
|
|
|
2012-05-18 02:40:38 +04:00
|
|
|
ADDON_ID = r"""(?P<addon_id>[^/<>"']+)"""
|
2012-04-10 05:45:03 +04:00
|
|
|
|
2012-02-18 03:17:57 +04:00
|
|
|
urlpatterns = patterns('',
|
2012-03-15 00:07:14 +04:00
|
|
|
# Home.
|
2012-09-01 02:42:48 +04:00
|
|
|
url('^$', 'mkt.home.views.home', name='home'),
|
2012-04-06 02:48:54 +04:00
|
|
|
|
2012-03-17 01:16:07 +04:00
|
|
|
# App Detail pages.
|
2012-05-02 22:14:31 +04:00
|
|
|
('^app/%s/' % amo.APP_SLUG, include('mkt.detail.urls')),
|
2012-03-17 01:16:07 +04:00
|
|
|
|
2012-03-23 06:53:28 +04:00
|
|
|
# Browse pages.
|
2012-04-04 20:22:40 +04:00
|
|
|
('^apps/', include('mkt.browse.urls')),
|
2012-03-22 05:35:08 +04:00
|
|
|
|
2012-06-05 09:19:59 +04:00
|
|
|
# Dev Ecosystem
|
|
|
|
('^developers/', include('mkt.ecosystem.urls')),
|
|
|
|
('^ecosystem/', lambda r: redirect('ecosystem.landing', permanent=True)),
|
|
|
|
|
2012-05-18 02:40:38 +04:00
|
|
|
# Theme detail pages.
|
|
|
|
('^theme/%s/' % ADDON_ID, include('mkt.themes.urls')),
|
|
|
|
|
|
|
|
# Theme browse pages.
|
2012-06-29 03:50:58 +04:00
|
|
|
('^themes/', include(theme_patterns)),
|
2012-05-18 02:40:38 +04:00
|
|
|
|
2012-02-18 03:17:57 +04:00
|
|
|
# Replace the "old" Developer Hub with the "new" Marketplace one.
|
|
|
|
('^developers/', include('mkt.developers.urls')),
|
2012-02-17 02:22:59 +04:00
|
|
|
|
2012-02-20 11:07:23 +04:00
|
|
|
# Submission.
|
|
|
|
('^developers/submit/app/', include('mkt.submit.urls')),
|
|
|
|
|
2012-03-21 00:20:58 +04:00
|
|
|
# In-app payments.
|
2012-03-28 00:31:00 +04:00
|
|
|
('^inapp-pay/', include('mkt.inapp_pay.urls')),
|
2012-03-21 00:20:58 +04:00
|
|
|
|
2012-03-28 12:25:01 +04:00
|
|
|
# Site events data.
|
|
|
|
url('^statistics/events-(?P<start>\d{8})-(?P<end>\d{8}).json$',
|
|
|
|
'stats.views.site_events', name='amo.site_events'),
|
|
|
|
|
|
|
|
# Site statistics that we are going to catch, the rest will fall through.
|
|
|
|
url('^statistics/', include('stats.urls')),
|
|
|
|
|
|
|
|
# Fall through for any URLs not matched above stats dashboard.
|
|
|
|
url('^statistics/', lambda r: redirect('/'), name='statistics.dashboard'),
|
|
|
|
|
2012-03-27 08:16:22 +04:00
|
|
|
# Support (e.g., refunds, FAQs).
|
|
|
|
('^support/', include('mkt.support.urls')),
|
|
|
|
|
2012-05-02 23:24:26 +04:00
|
|
|
# Users (Legacy).
|
|
|
|
('^user/(?P<user_id>\d+)/', include(user_detail_patterns)),
|
|
|
|
('^users/', include(users_users_patterns)),
|
|
|
|
|
2012-03-24 05:13:25 +04:00
|
|
|
# Account info (e.g., purchases, settings).
|
2012-04-04 20:22:40 +04:00
|
|
|
('^users/', include(mkt_users_patterns)),
|
|
|
|
('^purchases/', include(purchases_patterns)),
|
|
|
|
('^settings', include(settings_patterns)),
|
2012-02-09 15:27:26 +04:00
|
|
|
|
2012-03-15 00:07:14 +04:00
|
|
|
# Site Search.
|
|
|
|
('^search/', include('mkt.search.urls')),
|
2012-02-22 08:44:51 +04:00
|
|
|
|
2012-04-03 01:34:59 +04:00
|
|
|
# Reviewer tools.
|
2012-04-03 04:58:17 +04:00
|
|
|
('^reviewers/', include('mkt.reviewers.urls')),
|
2012-04-03 01:34:59 +04:00
|
|
|
|
2012-05-23 03:29:49 +04:00
|
|
|
# Account lookup.
|
2012-06-27 22:52:48 +04:00
|
|
|
('^lookup/', include('mkt.lookup.urls')),
|
2012-05-23 03:29:49 +04:00
|
|
|
|
2012-08-16 04:32:54 +04:00
|
|
|
# Account lookup.
|
|
|
|
('^offline/', include('mkt.offline.urls')),
|
|
|
|
|
2012-02-22 08:44:51 +04:00
|
|
|
# Javascript translations.
|
|
|
|
url('^jsi18n.js$', cache_page(60 * 60 * 24 * 365)(javascript_catalog),
|
|
|
|
{'domain': 'javascript', 'packages': ['zamboni']}, name='jsi18n'),
|
|
|
|
|
2012-07-25 22:23:42 +04:00
|
|
|
# BlueVia / nav.pay() services.
|
|
|
|
('^services/bluevia/', include(bluevia_services_patterns)),
|
|
|
|
|
2012-02-23 21:42:53 +04:00
|
|
|
# Paypal, needed for IPNs only.
|
2012-04-04 20:22:40 +04:00
|
|
|
('^services/', include('paypal.urls')),
|
2012-02-23 21:42:53 +04:00
|
|
|
|
2012-02-22 08:44:51 +04:00
|
|
|
# AMO admin (not django admin).
|
|
|
|
('^admin/', include('zadmin.urls')),
|
2012-02-24 01:31:57 +04:00
|
|
|
|
2012-05-01 01:04:52 +04:00
|
|
|
# AMO Marketplace admin (not django admin).
|
|
|
|
('^admin/', include('mkt.zadmin.urls')),
|
|
|
|
|
2012-02-24 01:31:57 +04:00
|
|
|
# Accept extra junk at the end for a cache-busting build id.
|
|
|
|
url('^addons/buttons.js(?:/.+)?$', 'addons.buttons.js'),
|
2012-02-09 15:27:26 +04:00
|
|
|
|
2012-02-18 06:28:11 +04:00
|
|
|
# Developer Registration Login.
|
|
|
|
url('^login$', login, name='users.login'),
|
2012-02-22 08:44:51 +04:00
|
|
|
url('^logout$', logout, name='users.logout'),
|
2012-04-04 20:22:40 +04:00
|
|
|
|
2012-05-14 15:29:51 +04:00
|
|
|
url('^api/', include('mkt.api.urls')),
|
|
|
|
|
2012-05-21 20:01:40 +04:00
|
|
|
url('^appcache/', include('django_appcache.urls')),
|
|
|
|
|
2012-08-15 22:39:36 +04:00
|
|
|
url('^downloads/', include('mkt.downloads.urls')),
|
|
|
|
|
2012-04-04 20:22:40 +04:00
|
|
|
# Try and keep urls without a prefix at the bottom of the list for
|
|
|
|
# minor performance reasons.
|
|
|
|
|
|
|
|
# Misc pages.
|
|
|
|
('', include('mkt.site.urls')),
|
|
|
|
|
|
|
|
# Services.
|
|
|
|
('', include('apps.amo.urls')),
|
2012-02-18 06:28:11 +04:00
|
|
|
)
|
|
|
|
|
2012-02-23 02:04:10 +04:00
|
|
|
if settings.TEMPLATE_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',
|
|
|
|
{'document_root': settings.MEDIA_ROOT}),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if settings.SERVE_TMP_PATH and settings.DEBUG:
|
|
|
|
# Serves any URL like /tmp/* from your local ./tmp/ dir
|
|
|
|
urlpatterns += patterns('',
|
|
|
|
(r'^tmp/(?P<path>.*)$', 'django.views.static.serve',
|
|
|
|
{'document_root': settings.TMP_PATH}),
|
|
|
|
)
|