from django.urls import path, include from .views import * def colloct_class_based_views(): ret = [] for cls in BaseView.__subclasses__(): if hasattr(cls, 'get_urls'): ret += cls.get_urls() else: ret.append(path(cls.get_path(), cls.as_view())) return ret urlpatterns = [ path('', include(v1_api.urls)), ] + colloct_class_based_views()