Django REST Framework - how to disable the Browsable API in production


DRF tip:

If you want to use the Browsable API in development but not in production, you can set DEFAULT_RENDERER_CLASSES in settings conditionally, like so:

if not DEBUG:
    REST_FRAMEWORK["DEFAULT_RENDERER_CLASSES"] = (
            "rest_framework.renderers.JSONRenderer",
        )