Невозможность загрузки определения API Swagger - Django rest Framework
Я совсем новичок в DRF и Python нужна ваша помощь здесь
.
получаю Swagger ERROR "Fail to load API definition", при загрузке Swagger страницы
используя пакет drf-yasg
ниже приведены мои конфигурации
примечание: app - это название моего Django-проекта, а repertoire - это Django-приложение
app\urls.py
schema_view = get_schema_view(
openapi.Info(
title="BMAT API",
default_version="v1",
description="BMAT API v1",
terms_of_service="",
contact=openapi.Contact(email="sivaperumal2000@gmail.com"),
),
public=True,
urlconf="app.urls",
)
urlpatterns = [
path(
"",
schema_view.with_ui("swagger", cache_timeout=0),
name="v1-schema-swagger-ui",
),
path("repertoire/", include("repertoire.urls"))
]
Error MSG
Internal Server Error: /
Traceback (most recent call last):
File "D:\Django\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "D:\Django\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "D:\Django\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "D:\Django\venv\lib\site-packages\django\views\decorators\csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "D:\Django\venv\lib\site-packages\django\views\generic\base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "D:\Django\venv\lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "D:\Django\venv\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "D:\Django\venv\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "D:\Django\venv\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "D:\Django\venv\lib\site-packages\drf_yasg\views.py", line 94, in get
schema = generator.get_schema(request, self.public)
File "D:\Django\venv\lib\site-packages\drf_yasg\generators.py", line 242, in get_schema
endpoints = self.get_endpoints(request)
File "D:\Django\venv\lib\site-packages\drf_yasg\generators.py", line 311, in get_endpoints
enumerator = self.endpoint_enumerator_class(self._gen.patterns, self._gen.urlconf, request=request)
File "D:\Django\venv\lib\site-packages\drf_yasg\generators.py", line 30, in __init__
super(EndpointEnumerator, self).__init__(patterns, urlconf)
File "D:\Django\venv\lib\site-packages\rest_framework\schemas\generators.py", line 65, in __init__
urls = import_module(urlconf)
File "c:\program files\python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'app'