David Brown David Brown - 2 months ago 53
Python Question

Exclude URLs from Django REST Swagger

I have a few URLs that I want to exclude from my REST API documentation. I'm using Django REST Swagger and the only documentation I can find (https://github.com/marcgibbons/django-rest-swagger) doesn't really tell me much. There is the "exclude_namespaces" part of SWAGGER_SETTINGS in settings.py, but there is no real explanation or example of how to use this.

Simply put, I want to exclude any URLs from the docs that start with the following:


How could I go about doing this?

Thanks in advance for any help offered :P


the namespaces to exclude are the one defined in your urls.py.

So for example, in your case:


internal_apis = patterns('',

urlpatterns = urlpatterns + patterns('',
              url(r'^', include(internal_apis, namespace="internal_apis")),

and in your settings.py:

    "exclude_namespaces": ["internal_apis"],    #  List URL namespaces to ignore

This is well described in there