Skip to content

Commit dae4604

Browse files
author
Emmanouil Konstantinidis
committed
Exclude "serve" view (static files)
1 parent 15ac572 commit dae4604

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drfdocs/api_docs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
class ApiDocumentation(object):
66
excluded_apps = ["admin", "drfdocs"]
7+
excluded_endpoints = ["serve"]
78
root_urlconf = __import__(settings.ROOT_URLCONF)
89

910
def __init__(self):
@@ -14,7 +15,7 @@ def get_all_view_names(self, urlpatterns):
1415
for pattern in urlpatterns:
1516
if isinstance(pattern, RegexURLResolver) and (pattern.app_name not in self.excluded_apps):
1617
self.get_all_view_names(pattern.url_patterns)
17-
elif isinstance(pattern, RegexURLPattern):
18+
elif isinstance(pattern, RegexURLPattern) and (pattern.callback.__name__ not in self.excluded_endpoints):
1819
self.view_names.append(pattern.callback.__name__)
1920

2021
def get_views(self):

0 commit comments

Comments
 (0)