drf框架安裝配置及其功能概述

0902自我總結

drf框架安裝配置及其功能概述

一.安裝

pip3 install djangorestframeworkpython

二.配置

# 註冊drf app
NSTALLED_APPS = [
    # ...
    'rest_framework',
]

三.特色

# 具體功能在具體模塊下
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.exceptions import APIException
from rest_framework.filters import OrderingFilter
from rest_framework.views import APIView
from rest_framework.pagination import PageNumberPagination
from rest_framework.settings import APISettings

# 自定義drf配置 - 在本身的settings.py
REST_FRAMEWORK = {
    # 自定義修改drf的配置們
}
相關文章
相關標籤/搜索