You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

urls.py 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from django.conf.urls import include, url
  2. from django.conf import settings
  3. from django.conf.urls.i18n import i18n_patterns
  4. from django.contrib import admin
  5. from django.conf.urls.static import static
  6. from oscar.app import shop
  7. from oscar.views import handler500, handler404, handler403 # noqa
  8. from apps.sitemaps import base_sitemaps
  9. admin.autodiscover()
  10. urlpatterns = [
  11. # Include admin as convenience. It's unsupported and you should
  12. # use the dashboard
  13. url(r'^admin/', include(admin.site.urls)),
  14. # i18n URLS need to live outside of i18n_patterns scope of the shop
  15. url(r'^i18n/', include('django.conf.urls.i18n')),
  16. # include a basic sitemap
  17. url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.index', {
  18. 'sitemaps': base_sitemaps}),
  19. url(r'^sitemap-(?P<section>.+)\.xml$',
  20. 'django.contrib.sitemaps.views.sitemap', {'sitemaps': base_sitemaps}),
  21. ]
  22. # Prefix Oscar URLs with language codes
  23. urlpatterns += i18n_patterns('',
  24. # Custom functionality to allow dashboard users to be created
  25. url(r'gateway/', include('apps.gateway.urls')),
  26. # Oscar's normal URLs
  27. url(r'', include(shop.urls)),
  28. )
  29. if settings.DEBUG:
  30. import debug_toolbar
  31. # Server statics and uploaded media
  32. urlpatterns += static(settings.MEDIA_URL,
  33. document_root=settings.MEDIA_ROOT)
  34. # Allow error pages to be tested
  35. urlpatterns += [
  36. url(r'^403$', handler403),
  37. url(r'^404$', handler404),
  38. url(r'^500$', handler500),
  39. url(r'^__debug__/', include(debug_toolbar.urls)),
  40. ]