2009-04-12 03:50:47 +00:00
|
|
|
# coding: utf-8
|
2007-09-17 14:48:33 +00:00
|
|
|
from os import path
|
|
|
|
|
2011-09-11 22:36:16 +00:00
|
|
|
from django.conf.urls import patterns, url, include
|
2012-12-08 10:13:52 +00:00
|
|
|
from django.utils._os import upath
|
2007-09-19 13:26:56 +00:00
|
|
|
|
2011-10-13 21:34:56 +00:00
|
|
|
from . import views
|
2007-09-17 14:48:33 +00:00
|
|
|
|
2008-07-18 19:45:00 +00:00
|
|
|
|
2012-12-08 10:13:52 +00:00
|
|
|
base_dir = path.dirname(path.abspath(upath(__file__)))
|
2007-09-17 14:48:33 +00:00
|
|
|
media_dir = path.join(base_dir, 'media')
|
|
|
|
locale_dir = path.join(base_dir, 'locale')
|
|
|
|
|
|
|
|
js_info_dict = {
|
|
|
|
'domain': 'djangojs',
|
2013-02-26 12:19:18 +00:00
|
|
|
'packages': ('view_tests',),
|
2007-09-17 14:48:33 +00:00
|
|
|
}
|
|
|
|
|
2010-12-13 13:52:52 +00:00
|
|
|
js_info_dict_english_translation = {
|
|
|
|
'domain': 'djangojs',
|
2013-02-26 12:19:18 +00:00
|
|
|
'packages': ('view_tests.app0',),
|
2010-12-13 13:52:52 +00:00
|
|
|
}
|
|
|
|
|
2010-05-13 13:29:31 +00:00
|
|
|
js_info_dict_multi_packages1 = {
|
|
|
|
'domain': 'djangojs',
|
2013-02-26 12:19:18 +00:00
|
|
|
'packages': ('view_tests.app1', 'view_tests.app2'),
|
2010-05-13 13:29:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
js_info_dict_multi_packages2 = {
|
|
|
|
'domain': 'djangojs',
|
2013-02-26 12:19:18 +00:00
|
|
|
'packages': ('view_tests.app3', 'view_tests.app4'),
|
2010-05-13 13:29:31 +00:00
|
|
|
}
|
|
|
|
|
2012-11-17 14:37:30 +00:00
|
|
|
js_info_dict_admin = {
|
|
|
|
'domain': 'djangojs',
|
2013-02-26 12:19:18 +00:00
|
|
|
'packages': ('django.contrib.admin', 'view_tests'),
|
2012-11-17 14:37:30 +00:00
|
|
|
}
|
|
|
|
|
2014-02-18 13:46:23 +00:00
|
|
|
js_info_dict_app5 = {
|
|
|
|
'domain': 'djangojs',
|
|
|
|
'packages': ('view_tests.app5',),
|
|
|
|
}
|
|
|
|
|
2007-09-17 14:48:33 +00:00
|
|
|
urlpatterns = patterns('',
|
|
|
|
(r'^$', views.index_page),
|
2008-07-18 19:45:00 +00:00
|
|
|
|
2007-09-19 13:26:56 +00:00
|
|
|
# Default views
|
2007-09-17 14:48:33 +00:00
|
|
|
(r'^non_existing_url/', 'django.views.defaults.page_not_found'),
|
|
|
|
(r'^server_error/', 'django.views.defaults.server_error'),
|
2008-07-18 19:45:00 +00:00
|
|
|
|
2011-04-02 13:27:40 +00:00
|
|
|
# a view that raises an exception for the debug view
|
2011-08-12 14:15:31 +00:00
|
|
|
(r'raises/$', views.raises),
|
2013-08-04 09:01:01 +00:00
|
|
|
|
|
|
|
(r'raises400/$', views.raises400),
|
2011-08-12 14:15:31 +00:00
|
|
|
(r'raises403/$', views.raises403),
|
2013-08-04 09:01:01 +00:00
|
|
|
(r'raises404/$', views.raises404),
|
2012-10-20 12:50:44 +00:00
|
|
|
(r'raises500/$', views.raises500),
|
2011-04-02 13:27:40 +00:00
|
|
|
|
2007-09-19 13:26:56 +00:00
|
|
|
# i18n views
|
2008-07-18 19:45:00 +00:00
|
|
|
(r'^i18n/', include('django.conf.urls.i18n')),
|
2007-09-17 14:48:33 +00:00
|
|
|
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
|
2014-02-18 13:46:23 +00:00
|
|
|
(r'^jsi18n/app5/$', 'django.views.i18n.javascript_catalog', js_info_dict_app5),
|
2010-12-13 13:52:52 +00:00
|
|
|
(r'^jsi18n_english_translation/$', 'django.views.i18n.javascript_catalog', js_info_dict_english_translation),
|
2010-05-13 13:29:31 +00:00
|
|
|
(r'^jsi18n_multi_packages1/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages1),
|
|
|
|
(r'^jsi18n_multi_packages2/$', 'django.views.i18n.javascript_catalog', js_info_dict_multi_packages2),
|
2012-11-17 14:37:30 +00:00
|
|
|
(r'^jsi18n_admin/$', 'django.views.i18n.javascript_catalog', js_info_dict_admin),
|
|
|
|
(r'^jsi18n_template/$', views.jsi18n),
|
2008-07-18 19:45:00 +00:00
|
|
|
|
2007-09-19 13:26:56 +00:00
|
|
|
# Static views
|
2007-09-17 14:48:33 +00:00
|
|
|
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': media_dir}),
|
2010-03-02 19:37:48 +00:00
|
|
|
)
|
|
|
|
|
2013-02-26 12:19:18 +00:00
|
|
|
urlpatterns += patterns('view_tests.views',
|
2010-03-08 15:20:29 +00:00
|
|
|
url(r'view_exception/(?P<n>\d+)/$', 'view_exception', name='view_exception'),
|
2010-03-08 17:01:21 +00:00
|
|
|
url(r'template_exception/(?P<n>\d+)/$', 'template_exception', name='template_exception'),
|
2013-02-24 15:41:10 +00:00
|
|
|
url(r'^raises_template_does_not_exist/(?P<path>.+)$', 'raises_template_does_not_exist', name='raises_template_does_not_exist'),
|
2013-09-06 20:50:18 +00:00
|
|
|
url(r'^render_no_template/$', 'render_no_template', name='render_no_template'),
|
2010-09-11 03:13:23 +00:00
|
|
|
)
|