简体   繁体   中英

what can I return in Django Views.py function, if I dont want to return anything?

I am working on a project using Django where I am creating a login authentication. I have created a function in Views.py (login) and I don't want to return anything, so I tried returning none . This yields an error, so what can I return instead?

The view returns an HttpResponse object that contains the generated response. Each view function is responsible for returning an HttpResponse object.

view on django has default return

`from django.http import HttpResponse

    def my_view(request):
    return HttpResponse(status=201)`

visit docs for more info: https://docs.djangoproject.com/en/3.0/topics/http/views/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM