[ Foro de Python ]
Buenos dias
tengo error en esta linea de codigo
cur = db.cursor()
cur.execute('SELECT * FROM usuarios WHERE usuario = %s AND clave = %s', (_usuario, _password,))
account = cur.fetchone()
if account:
session['logueado'] = True
session['id'] = account['id']
session['id_rol'] = account['id_rol'] // TypeError: tuple indices must be integers or slices, not str
# Comparamos el rol con el usuario
if session['id_rol'] == 1:
return render_template("admin.html")
elif session['id_rol'] == 2:
return render_template("menu.html")
else:
return render_template('index.html')