分类标签归档:django-rest-framework

django rest framework


1.安装

pip install djangorestframework
pip install markdown       # Markdown support for the browsable API.
pip install django-filter  # Filtering support
  • 修改settings 文件的INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'rest_framework',
]
  • 添加路由
    urlpatterns = [
      ...
      url(r'^api-auth/',

Read more

鉴黄接口


1、服务端安装

把雅虎的鉴黄模型下载到服务器

git clone https://github.com/yahoo/open_nsfw.git
# 如果clone比较慢,可以直接下载zip包也行

2、构建Caffe Docker映像(CPU)

docker build -t caffe:cpu https://raw.githubusercontent.com/BVLC/caffe/master/docker/cpu/Dockerfile

3、进行鉴黄

cd open_nsfw
docker run --volume=$(pwd):/workspace caffe:cpu \
python

Read more

django rest framework 安装与使用


1、安装

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

2、 添加rest_framework 到settings

INSTALLED_APPS = [
    ...
    'rest_framework',
]

3、样例

from django.contrib import admin
from django.urls import path, include
f

Read more