import django

from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps import views

from oscar.app import application
from oscar.views import handler500, handler404, handler403

from apps.sitemaps import base_sitemaps
from apps.gateway import urls as gateway_urls


admin.autodiscover()

urlpatterns = [
    # Include admin as convenience. It's unsupported and only included
    # for developers.
    url(r'^admin/', include(admin.site.urls)),
    # i18n URLS need to live outside of i18n_patterns scope of Oscar
    url(r'^i18n/', include(django.conf.urls.i18n)),
    # include a basic sitemap
    url(r'^sitemap\.xml$', views.index, {
        'sitemaps': base_sitemaps}),
    url(r'^sitemap-(?P<section>.+)\.xml$',
        views.sitemap, {'sitemaps': base_sitemaps}),
]

# Prefix Oscar URLs with language codes
urlpatterns += i18n_patterns(
    # Custom functionality to allow dashboard users to be created
    url(r'gateway/', include(gateway_urls)),
    # Oscar's normal URLs
    url(r'^', include(application.urls)),
)

if settings.DEBUG:
    import debug_toolbar

    # Server statics and uploaded media
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
    # Allow error pages to be tested
    urlpatterns += [
        url(r'^403$', handler403),
        url(r'^404$', handler404),
        url(r'^500$', handler500),
        url(r'^__debug__/', include(debug_toolbar.urls)),
    ]

@@ -7,17 +7,16 @@
  django%0A
-%0A
 from dja
@@ -248,17 +248,16 @@
 t views%0A
-%0A
 from osc
@@ -313,19 +313,19 @@
  handler
-500
+403
 , handle
@@ -337,19 +337,19 @@
  handler
-403
+500
 %0A%0Afrom a
@@ -356,84 +356,83 @@
 pps.
-sitemaps import base_sitemaps%0Afrom apps.gateway import urls as gateway_urls%0A
+gateway import urls as gateway_urls%0Afrom apps.sitemaps import base_sitemaps
 %0A%0Aad
@@ -603,24 +603,25 @@
 ite.urls)),%0A
+%0A
     # i18n U
@@ -725,24 +725,25 @@
 rls.i18n)),%0A
+%0A
     # includ
@@ -799,18 +799,16 @@
 s.index,
- %7B
 %0A       
@@ -808,16 +808,17 @@
         
+%7B
 'sitemap
@@ -880,24 +880,16 @@
 %5C.xml$',
-%0A       
  views.s
@@ -895,16 +895,24 @@
 sitemap,
+%0A       
  %7B'sitem
@@ -931,18 +931,71 @@
 itemaps%7D
-)
 ,
+%0A        name='django.contrib.sitemaps.views.sitemap')
 %0A%5D%0A%0A# Pr

Fix the sandbox sitemap.xml view by setting the name in urls