I have a DJango application that have several entries in URL patterns (urls.py):
urlpatterns = patterns(
\'\',
# change Language
(r\'^i18n/\', in
Make a pattern that looks for the common URL prefix, then include a second patterns object:
urlpatterns = patterns(
'',
url(r'^myprefix/', include(patterns(
'',
# change Language
(r'^i18n/', include('django.conf.urls.i18n')),
url('^api/v1/', include(router.urls)),
url(r'^api-docs/', RedirectView.as_view(url='/api/v1/')),
url(r'^api/', RedirectView.as_view(url='/api/v1/')),
url(r'^api/v1', RedirectView.as_view(url='/api/v1/')),
# Et cetera
)
)
In fact you should perhaps group all the URLs that start with api/ this way, and definitely all the ones that start with r'^(?P.
Edit: I didn't test that, see the documentation under "Including other URLconfs".