Skip to content

Commit c692079

Browse files
committed
Update api_docs.py
1 parent d0fc0e1 commit c692079

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: rest_framework_docs/api_docs.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from importlib import import_module
12
from django.conf import settings
23
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern
34
from django.utils.module_loading import import_string
@@ -9,7 +10,11 @@ class ApiDocumentation(object):
910

1011
def __init__(self):
1112
self.endpoints = []
12-
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)
1318
if hasattr(root_urlconf, 'urls'):
1419
self.get_all_view_names(root_urlconf.urls.urlpatterns)
1520
else:

0 commit comments

Comments
 (0)