forked from mysociety/pombola
-
Notifications
You must be signed in to change notification settings - Fork 0
/
urls.py
134 lines (108 loc) · 3.8 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import re
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = []
# Country app. In order to let the country app inject its own pages we list it
# first and send all urls through it. If it does not match anything routing
# continues as normal.
#
# Note that anything the country app catches it has to actually process, Django
# does not appear to support fallthrough from controllers:
# http://stackoverflow.com/questions/4495763/fallthrough-in-django-urlconf
if settings.COUNTRY_APP:
urlpatterns += patterns('',
(r'^', include('pombola.' + settings.COUNTRY_APP + '.urls')),)
# Needs to occur _before_ admin.autodiscover()
import autocomplete_light
autocomplete_light.autodiscover()
# Admin section
from django.contrib import admin
admin.autodiscover()
from ajax_select import urls as ajax_select_urls
urlpatterns += patterns('',
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/lookups/', include(ajax_select_urls)),
url(r'^admin/', include(admin.site.urls)),
url(r'^autocomplete_light/', include('autocomplete_light.urls')),
)
# mapit
urlpatterns += patterns('',
(r'^mapit/', include('mapit.urls')),
)
# Info pages
urlpatterns += patterns('',
(r'^info/', include('pombola.info.urls.pages')),
(r'^blog/', include('pombola.info.urls.blog')),
)
# File archive
urlpatterns += patterns('',
(r'^file_archive/', include('pombola.file_archive.urls')),
)
# SayIt - speeches
#if settings.ENABLED_FEATURES['speeches']:
# urlpatterns += patterns('',
# (r'^speeches/', include('speeches.urls', namespace='speeches', app_name='speeches-default')),
# )
# Hansard pages
if settings.ENABLED_FEATURES['hansard']:
urlpatterns += patterns('',
(r'^hansard/', include('pombola.hansard.urls', namespace='hansard', app_name='hansard')),
)
# Project pages
if settings.ENABLED_FEATURES['projects']:
urlpatterns += patterns('',
(r'^projects/', include('pombola.projects.urls')),
)
# ajax preview of the markdown
urlpatterns += patterns('',
url(r'^markitup/', include('markitup.urls'))
)
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# needed for the selenium tests.
if settings.IN_TEST_MODE:
static_url = re.escape(settings.STATIC_URL.lstrip('/'))
urlpatterns += patterns('',
url(r'^%s(?P<path>.*)$' % static_url, 'django.views.static.serve', {
'document_root': settings.STATIC_ROOT,
}),
)
# search
urlpatterns += patterns('',
(r'^search/', include('pombola.search.urls')),
)
# feedback
urlpatterns += patterns('',
(r'^feedback/', include('pombola.feedback.urls')),
)
# map
urlpatterns += patterns('',
(r'^map/', include('pombola.map.urls')),
)
# votematch
if settings.ENABLED_FEATURES['votematch']:
urlpatterns += patterns('',
(r'^votematch/', include('pombola.votematch.urls')),
)
# # spinner - uncomment if needed. Not needed just to display spinner on the
# # homepage using carousel.
# if settings.ENABLED_FEATURES['spinner']:
# urlpatterns += patterns('',
# (r'^spinner/', include('pombola.spinner.urls')),
# )
# bills
if settings.ENABLED_FEATURES['bills']:
urlpatterns += patterns('',
(r'^bills/', include('pombola.bills.urls', namespace='bills', app_name='bills')),
)
# Everything else goes to core
urlpatterns += patterns('',
(r'^', include('pombola.core.urls')),
)
# For South Africa, we need SayIt to catch any otherwise unmatched
# URLs, so this has to come last:
if settings.COUNTRY_APP and settings.COUNTRY_APP == 'south_africa':
urlpatterns += patterns('',
(r'^', include('pombola.south_africa.fallback_urls')),)