判断用户是否登录

def cmdbindex(req):
       if not request.user.is_authenticated():
          return render(request, 'login_error.html')
       else:
         return render_to_response('cmdb/index.html')
会跳转到错误页面
		 
		 
def cmdbindex(req):
         return render_to_response('cmdb/index.html')

http://192.168.137.3:9000/cmdb/index/  不需要登录可以直接访问
原文地址:https://www.cnblogs.com/hzcya1995/p/13349038.html