【RestAPI前言(二)】restful api环境搭建及简介
2018-09-13 本文已影响0人
kingloongMagic
官网: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="慕学生鲜")),