即时通讯没有得到确切..实际上在httpresponse重定向它什么也没有显示。 实际上http://127.0.0.1:8000/login/在显示我的登录页面 现在我想正确登录它将重定向到我的索引页面。 不确切的方式。django页面重定向成功登录
def login(request):
template = "../templates/admin/login.html"
data = {
}
user = auth.authenticate(username='aa', password='bb')
if user is not None and user.is_active:
template = "../templates/admin/index.html"
auth.login(request, user)
return HttpResponseRedirect("/login/index/")
return render_to_response(template, data,
context_instance = RequestContext(request))
thanx提前。
http://docs.djangoproject.com/en/1.3/topics/auth/#django.contrib.auth.login – 2011-03-29 13:17:56
看起来是对的,我(假定压痕是在你的版本是正确的)。那会抛出一个python错误,无论如何重定向到'/ login/index /',或者重定向成功。你说它正在返回一个空白页面? – 2011-03-29 13:28:06
实际上,当我写http://127.0.0.1:8000/login/它会自动重定向到索引页面,而不显示登录页面 – gurr 2011-03-29 13:39:27