how to use swagger in django

时间:2022-10-16 19:34:45

I'm a beginner of swagger, i have a website written in django(already done), and i want to use swagger to exhibit my apis. I'v read the docs in swagger.io for days, but I still need more help.

我是一个招摇的初学者,我有一个用django写的网站(已经完成),我想用swagger展示我的apis。我在swagger.io上阅读了几天的文档,但我仍然需要更多的帮助。

I also tried the Django REST Swagger(https://github.com/marcgibbons/django-rest-swagger). I tried the basic example (http://django-rest-swagger.readthedocs.org/en/latest/examples.html#basic-example-with-a-viewset), but it still not work.

我也尝试过Django REST Swagger(https://github.com/marcgibbons/django-rest-swagger)。我尝试了基本的例子(http://django-rest-swagger.readthedocs.org/en/latest/examples.html#basic-example-with-a-viewset),但它仍然不起作用。

Maybe i did something wrong, can anyone help me?

也许我做错了什么,谁能帮助我?

1 个解决方案

#1


0  

The Django Rest Swagger package is very useful for this.

Django Rest Swagger包对此非常有用。

Did you put 'rest_framework_swagger' into your INSTALLED_APPS setting?

你把'rest_framework_swagger'放到你的INSTALLED_APPS设置中了吗?

If you did, just put the url(r'^docs/', include('rest_framework_swagger.urls')) in the urls.py where you are exposing your API endpoints and it should display all the other url's that you have in that file.

如果你这样做,只需将url(r'^ docs /',include('rest_framework_swagger.urls'))放在你公开API端点的urls.py中,它应该显示你所拥有的所有其他网址。文件。

#1


0  

The Django Rest Swagger package is very useful for this.

Django Rest Swagger包对此非常有用。

Did you put 'rest_framework_swagger' into your INSTALLED_APPS setting?

你把'rest_framework_swagger'放到你的INSTALLED_APPS设置中了吗?

If you did, just put the url(r'^docs/', include('rest_framework_swagger.urls')) in the urls.py where you are exposing your API endpoints and it should display all the other url's that you have in that file.

如果你这样做,只需将url(r'^ docs /',include('rest_framework_swagger.urls'))放在你公开API端点的urls.py中,它应该显示你所拥有的所有其他网址。文件。