我正在尝试将文档添加到我的Django应用程序中。我按照official Django Built-in API documentation做了每件事。但是,当我打开实例localhost:8000/docs/
时,我没有得到任何结果。只有白色的屏幕。我想买些像this的东西。我不知道怎么了。一切似乎都做得很好。我将coreapi
、markdown
和{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不能工作。在
我遇到了和你一样的问题。 我更正这个问题如下。在
在您的代码中:
更改为:
^{pr2}$相关问题 更多 >
编程相关推荐