django要求:
django >= 2.x
@request_mapping(value="/user")
class UserView(View):
@request_mapping(value="/get_info/")
def get_user_info_by_token(self, request, *args, **kwargs):
return HttpResponse("ok")
@request_mapping(value="/get_list/<int:year>/")
def some_others(self, request, year, *args, **kwargs):
return HttpResponse("ok")
@request_mapping(value="/login/", method="post")
def login(self, request, *args, **kwargs):
return HttpResponse("ok")
需要一个第三方库:
pip install django-request-mapping
详细:
https://github.com/sazima/django-request-mapping