Django Rest Framework - 初识

Django的REST框架是一个强大而灵活的工具用于构建Web API。

1. 它是什么?

Django REST framework is a powerful and flexible toolkit for building Web APIs.

翻译: 牛B的web API工具框架

Django Rest Framework - 初识_第1张图片

作为一名Android 开发工程师 ,以我使用的rest api来说,这是我目前见过最方便的,最灵活的开发方式。虽然之前接触的后台开发不多,但是就接口api 而言,这个是我喜欢的,符合我的胃口。


2. 为啥使用它?

看看官方给出使用它的原因:

Some reasons you might want to use REST framework:

The Web browsable API is a huge usability win for your developers.
Authentication policies including packages for OAuth1a and OAuth2.
Serialization that supports both ORM and non-ORM data sources.
Customizable all the way down - just use regular function-based views if you don't need the more powerful features.
Extensive documentation, and great community support.
Used and trusted by internationally recognised companies including Mozilla, Red Hat, Heroku, and Eventbrite.

你可能想使用休息框架的一些原因:

  • Web浏览器API是开发者一个巨大的可用性赢得。
  • 认证政策包括oauth1a和oauth2包。
  • 序列化支持ORM和非ORM数据源。
  • 自定义所有的方式下-只使用正则函数为基础的意见,如果你不需要更强大的功能
  • 广泛的文档,和伟大的社区支持。
  • 用国际认可的公司包括Mozilla,红帽,Heroku的信任,和Eventbrite。

3. 干啥使用它?

开发rest api接口 (快速)

下面将以一个栗子进行总结学习,内容包含下面内容:

  1. 安装与配置
  2. 增删改查
  3. API文档
  4. 用户相关
  5. Token验证
  6. 分页加载
  7. 异常数据返回
  8. API 版本
  9. …..

初步效果预览 :

Django Rest Framework - 初识_第2张图片


Github 地址 :

Demo 地址: https://github.com/LABELNET/django-mysite-frist

你可能感兴趣的:(django,rest,framework,python)