我的登录页面设置在/
http://127.0.0.1:8000/
但我希望登录后重定向到同一页面http://127.0.0.1:8000/
而不是http://127.0.0.1:8000/home
,就像Facebook登录一样。
怎么能让这成为可能呢?
答案 0 :(得分:0)
您应该分享您的views.py代码
无论如何你可以使用HttpResponseRedirect
示例:
from django.http import HttpResponseRedirect def index(request): # you logic to check login return HttpResponseRedirect('/') # it will redirect you to "/"