In my experience in different projects and teams, we did it in this way:
application
├── api
│ ├── __init__.py
│ ├── urls.py
│ └── v1
│ ├── __init__.py
│ ├── view_a.py
│ ├── ...
│ ├── view_z.py
│ └── urls.py
├── apps.py
...
I keep my views in different versions, so we can support backward compatibilities in APIs and Views.
You have to create a Python Package (a directory including an __init__ file); And just import everything you want to export from that package.
For example, in application/api/v1/__init__.py:
from .view_a import FooListView
from .view_b import BarDetailView
And, of course, you can create classes inside the __init__ file too. Everything you write in it is accessible from the Package's name directly instead of the views' file name.
Don't forget to keep versioning your APIs in urls.py too.
# api/urls.py
from django.urls import path, include
urlpatterns = [
path('v1/', include('application.api.v1.urls')),
path('v2/', include('application.api.v2.urls')),
...
]
# api/v1/urls.py
from django.urls import path
from . import * # this imports every view classes from __init__.py file
# Or you can just import directly from views instead
# of having an __init__ file:
# from .view_a import FooListView
urlpatterns = [
path('foo/', FooListView.as_view()),
...
]