美文网首页
【RestAPI前言(二)】restful api环境搭建及简介

【RestAPI前言(二)】restful api环境搭建及简介

作者: kingloongMagic | 来源:发表于2018-09-13 14:04 被阅读0次

官网:http://www.django-rest-framework.org/

环境搭建

pip install django
pip install djangorestframework
pip install markdown # Markdown support for the browsable API.
pip install django-filter # Filtering support

将rest_framework添加到项目apps配置中:

添加'rest_framework'到您的INSTALLED_APPS设置

INSTALLED_APPS = (
    ...
    'rest_framework',
)

API文档功能

# 导入rest_framework文档功能
from rest_framework.documentation import include_docs_urls
# url中映射一个url
url(r'docs/', include_docs_urls(title="慕学生鲜")),

相关文章

网友评论

      本文标题:【RestAPI前言(二)】restful api环境搭建及简介

      本文链接:https://www.haomeiwen.com/subject/rsglgftx.html