欢迎大家关注灰狐公众号:灰狐,微信号:HuihooChina

Django REST framework

来自开放百科 - 灰狐
跳转到: 导航, 搜索

Django REST framework

指南

pip install django
pip install djangorestframework
pip install django-rest-swagger
django-admin.py startproject example .
./manage.py syncdb

修改 example/urls.py 和 settings.py 后,

./manage.py runserver
http://127.0.0.1:8000/

curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/

[
   {
       "url": "http://127.0.0.1:8000/users/1/",
       "username": "huihoo",
       "email": "[email protected]",
       "is_staff": true
   },
   {
       "url": "http://127.0.0.1:8000/users/2/",
       "username": "gougou",
       "email": "[email protected]",
       "is_staff": false
   }
]
 

图集

链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱