We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d0fc0e1 commit c692079Copy full SHA for c692079
rest_framework_docs/api_docs.py
@@ -1,3 +1,4 @@
1
+from importlib import import_module
2
from django.conf import settings
3
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern
4
from django.utils.module_loading import import_string
@@ -9,7 +10,11 @@ class ApiDocumentation(object):
9
10
11
def __init__(self):
12
self.endpoints = []
- root_urlconf = import_string(settings.ROOT_URLCONF)
13
+ try:
14
+ root_urlconf = import_string(settings.ROOT_URLCONF)
15
+ except ImportError:
16
+ # Handle a case when there's no dot in ROOT_URLCONF
17
+ root_urlconf = import_module(settings.ROOT_URLCONF)
18
if hasattr(root_urlconf, 'urls'):
19
self.get_all_view_names(root_urlconf.urls.urlpatterns)
20
else:
0 commit comments