1、
打开pycharm创建工程及app
创建url
创建views函数:
from django.shortcuts import render
# Create your views here.
from django.views import View
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse@method_decorator(csrf_exempt,name='dispatch')
class apiviews(View):
def post(self,*args,**kwargs):
return HttpResponse('POST---create--order')
def get(self,*args,**kwargs):
return HttpResponse('get---create--order') def put(self, *args, **kwargs):
return HttpResponse('put---create--order') def delete(self, *args, **kwargs):
return HttpResponse('delete---create--order')
然后用pycharm运行:
打开POSTMAN进行测试:
标签:return,Postman,self,kwargs,django,api,import,HttpResponse From: https://blog.51cto.com/u_3369545/6590347