Once you configured your Ninja API and started runserver - go to http://127.0.0.1:8000/api/docs
You will see the automatic, interactive API documentation (provided by the OpenAPI / Swagger UI
CDN vs staticfiles
You are not required to put django ninja to
INSTALLED_APPS. In that case the interactive UI is hosted by CDN.
To host docs (Js/css) from your own server - just put "ninja" to INSTALLED_APPS - in that case standard django staticfiles mechanics will host it.
Switch to Redoc
NINJA_DOCS_VIEW in Django settings
NINJA_DOCS_VIEW = 'redoc'
Then you will see the alternative automatic documentation (provided by Redoc).
In case you do not need to display interactive documetation - set
docs_url argument to
api = NinjaAPI(docs_url=None)
To protect docs with authentication (or decorate for some other use case) use
from django.contrib.admin.views.decorators import staff_member_required api = NinjaAPI(docs_decorator=staff_member_required)