-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
51 lines (42 loc) · 1.62 KB
/
urls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import django
from django.apps import apps
from django.conf import settings
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 django.urls import include, path
from oscar.views import handler403, handler404, handler500
from apps.sitemaps import base_sitemaps
admin.autodiscover()
def trigger_error(request):
division_by_zero = 1 / 0
urlpatterns = [
# Include admin as convenience. It's unsupported and only included
# for developers.
path('admin/', admin.site.urls),
# i18n URLS need to live outside of i18n_patterns scope of Oscar
path('i18n/', include(django.conf.urls.i18n)),
# include a basic sitemap
path('sitemap.xml', views.index,
{'sitemaps': base_sitemaps}),
path('sitemap-<slug:section>.xml', views.sitemap,
{'sitemaps': base_sitemaps},
name='django.contrib.sitemaps.views.sitemap'),
path('sentry-debug/', trigger_error),
]
# Prefix Oscar URLs with language codes
urlpatterns += i18n_patterns(
path('', include(apps.get_app_config('oscar').urls[0])),
)
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 += [
path('403', handler403, {'exception': Exception()}),
path('404', handler404, {'exception': Exception()}),
path('500', handler500),
path('__debug__/', include(debug_toolbar.urls)),
]