The usual way to solve this problem would be to arrange route declarations so that the all-all route is obscured by tracing /api, that is:
urlpatterns = patterns('',
url(r'^api/', include('api.urls')),
url(r'^other/', 'views.other', name='other'),
url(r'^.*$', 'views.catchall', name='catch-all'),
)
, - , , Django, :
from django.core.urlresolvers import RegexURLPattern
class NoAPIPattern(RegexURLPattern):
def resolve(self, path):
if not path.startswith('api'):
return super(NoAPIPattern, self).resolve(path)
urlpatterns = patterns('',
url(r'^other/', 'views.other', name='other'),
NoAPIPattern(r'^.*$', 'views.catchall', name='catch-all'),
)