2007-09-17 22:48:33 +08:00
|
|
|
from os import path
|
|
|
|
|
|
|
|
from django.conf.urls.defaults import *
|
2007-09-19 21:26:56 +08:00
|
|
|
|
|
|
|
from models import *
|
2007-09-17 22:48:33 +08:00
|
|
|
import views
|
|
|
|
|
|
|
|
base_dir = path.dirname(path.abspath(__file__))
|
|
|
|
media_dir = path.join(base_dir, 'media')
|
|
|
|
locale_dir = path.join(base_dir, 'locale')
|
|
|
|
|
|
|
|
js_info_dict = {
|
|
|
|
'domain': 'djangojs',
|
|
|
|
'packages': ('regressiontests.views',),
|
|
|
|
}
|
|
|
|
|
2007-09-19 21:26:56 +08:00
|
|
|
date_based_info_dict = {
|
|
|
|
'queryset': Article.objects.all(),
|
|
|
|
'date_field': 'date_created',
|
|
|
|
'month_format': '%m',
|
|
|
|
}
|
|
|
|
|
2007-09-17 22:48:33 +08:00
|
|
|
urlpatterns = patterns('',
|
|
|
|
(r'^$', views.index_page),
|
2007-09-19 21:26:56 +08:00
|
|
|
|
|
|
|
# Default views
|
2007-09-17 22:48:33 +08:00
|
|
|
(r'^shortcut/(\d+)/(.*)/$', 'django.views.defaults.shortcut'),
|
|
|
|
(r'^non_existing_url/', 'django.views.defaults.page_not_found'),
|
|
|
|
(r'^server_error/', 'django.views.defaults.server_error'),
|
|
|
|
|
2007-09-19 21:26:56 +08:00
|
|
|
# i18n views
|
2007-09-17 22:48:33 +08:00
|
|
|
(r'^i18n/', include('django.conf.urls.i18n')),
|
|
|
|
(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
|
|
|
|
|
2007-09-19 21:26:56 +08:00
|
|
|
# Static views
|
2007-09-17 22:48:33 +08:00
|
|
|
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': media_dir}),
|
2007-09-19 21:26:56 +08:00
|
|
|
|
|
|
|
# Date-based generic views
|
|
|
|
(r'^date_based/object_detail/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/$',
|
|
|
|
'django.views.generic.date_based.object_detail',
|
|
|
|
dict(slug_field='slug', **date_based_info_dict)),
|
|
|
|
(r'^date_based/object_detail/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>[-\w]+)/allow_future/$',
|
|
|
|
'django.views.generic.date_based.object_detail',
|
|
|
|
dict(allow_future=True, slug_field='slug', **date_based_info_dict)),
|
|
|
|
(r'^date_based/archive_month/(?P<year>\d{4})/(?P<month>\d{1,2})/$',
|
|
|
|
'django.views.generic.date_based.archive_month',
|
|
|
|
date_based_info_dict),
|
2007-09-17 22:48:33 +08:00
|
|
|
)
|