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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import django
  2. from django.apps import apps
  3. from django.conf import settings
  4. from django.conf.urls.i18n import i18n_patterns
  5. from django.conf.urls.static import static
  6. from django.contrib import admin
  7. from django.contrib.sitemaps import views
  8. from django.urls import include, path
  9. from oscar.views import handler403, handler404, handler500
  10. from apps.sitemaps import base_sitemaps
  11. admin.autodiscover()
  12. urlpatterns = [
  13. # Include admin as convenience. It's unsupported and only included
  14. # for developers.
  15. path('admin/', admin.site.urls),
  16. # i18n URLS need to live outside of i18n_patterns scope of Oscar
  17. path('i18n/', include(django.conf.urls.i18n)),
  18. # include a basic sitemap
  19. path('sitemap.xml', views.index,
  20. {'sitemaps': base_sitemaps}),
  21. path('sitemap-<slug:section>.xml', views.sitemap,
  22. {'sitemaps': base_sitemaps},
  23. name='django.contrib.sitemaps.views.sitemap'),
  24. path('', include(apps.get_app_config('oscar').urls[0])),
  25. ]
  26. # Prefix Oscar URLs with language codes
  27. #
  28. r'''
  29. urlpatterns += i18n_patterns(
  30. path('', include(apps.get_app_config('oscar').urls[0])),
  31. )
  32. # '''
  33. if settings.DEBUG:
  34. import debug_toolbar
  35. # Server statics and uploaded media
  36. urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  37. # Allow error pages to be tested
  38. urlpatterns += [
  39. path('403', handler403, {'exception': Exception()}),
  40. path('404', handler404, {'exception': Exception()}),
  41. path('500', handler500),
  42. path('__debug__/', include(debug_toolbar.urls)),
  43. ]