django restframework 环境配置

Requirements:

coreapi (1.32.0+) - Schema generation support.
Markdown (2.1.0+) - Markdown support for the browsable API.
django-filter (1.0.1+) - Filtering support.
django-crispy-forms - Improved HTML display for filtering.
django-guardian (1.1.1+) - Object level permissions support.

$ pip3 install coreapi markdown django-filter django-crispy-forms django-guardian djangorestframework  

settings.py

INSTALLED_APPS = (
    ...
    'rest_framework',
) 

urls.py

from django.urls import path,include
from rest_framework.documentation import include_docs_urls

urlpatterns = [
    ...
    # 接口文档说明
    path(r'docs/',include_docs_urls(title="kcdb")),
    # rest_framework自带登录
    path(r'api-auth/', include('rest_framework.urls', namespace='rest_framework')),
]
posted @ 2019-03-04 15:12  家迪的家  阅读(719)  评论(0编辑  收藏  举报