1、
打开pycharm创建项目和app
创建url
创建views函数:
from django.shortcuts import render# Create your views here.from django.views import Viewfrom django.utils.decorators import method_decoratorfrom django.views.decorators.csrf import csrf_exemptfrom 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进行测试: