内置API Django文档不显示任何内容

2024-05-29 05:15:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试将文档添加到我的Django应用程序中。我按照official Django Built-in API documentation做了每件事。但是,当我打开实例localhost:8000/docs/时,我没有得到任何结果。只有白色的屏幕。我想买些像this的东西。我不知道怎么了。一切似乎都做得很好。我将coreapimarkdown和{}添加到requirements.txt文件中。在

我的urls.py

from rest_framework.documentation import include_docs_urls

API_TITLE = 'API title'
API_DESCRIPTION = '...'

urlpatterns = [
    url(r'^docs/', include_docs_urls(title=API_TITLE, description=API_DESCRIPTION))
]

日志:

^{pr2}$

MacBook电脑-专业:DockerProject myUser$coreapi gethttp://localhost:8000/docs/

<Error: 403 Forbidden>
    detail: "Authentication credentials were not provided."

解决方案 我在中使用了djangorestframework==3.6.2,而不是djangorestframework==3.6.3要求.txt. 我不知道为什么版本3.6.3不能工作。在


Tags: django文档txtapi应用程序localhostdocsinclude

热门问题