main_view_re = '^!({})/'.format('|'.join(list(d.keys())))
urlpatterns = [url('^{}/'.format(k), include(v)) for k, v in d]
urlpatterns.append(url(main_view_re, MainView.as_view()))
Match all urls without the prefix in Django