My flask app occurs Internal server error randomly while I try login. Sometimes it succeeds login but sometimes it doesn't. As well as this error, if I log in, it doesn't reach other menus and it never happened when I tested on localhost. This server doesn't work properly. I don't know why.
validate login
@app.route('/validateLogin',methods=['GET','POST'])
def validateLogin():
try:
if request.method=='POST':
_username = request.form['id']
_password = request.form['password']
cursor = con.cursor()
cursor.callproc('sp_validateLogin',(_username,))
data = cursor.fetchall()
direct to another page
@app.route('/school')
def school():
if session.get('user'):
return redirect('/getSchoolList')
else:
return redirect('/')
@app.route('/getSchoolList', methods=['POST','GET'])
def showSchoolList():
try:
if session.get('user'):
##con = mysql.connect()
cursor = con.cursor()
cursor.execute("select * from school")
schoollist = cursor.fetchall()
return render_template('/ann_school.html',schoollist=schoollist)
else:
return redirect('/error')
except Exception as e:
return redirect('/error')