from flask import Flask, url_for, request, render_template; from app import appVar; import redis; # Plug in to NoSQL Redis DB Server r = redis.StrictRedis(host='localhost', port=6379, db=0, charset='utf-8', decode_responses=True) #main_page @appVar.route('/') def hello(): myLink = url_for('fCreate') qList = r.keys('*:q') return render_template('TriviaIndex.html', questions=qList, Link=myLink) #sub_page @appVar.route('/createPage', methods=['GET', 'POST']) def fCreate(): if request.method == 'GET': # return empty form return render_template('CreateQuestion.html') elif request.method == 'POST': # reqad form data titleV = request.form['title'] answerV = request.form['answer'] questionV = request.form['question'] # save data to db r.set(titleV+':q', questionV) r.set(titleV+':a', answerV) return render_template('SubmitedPage.html', question = questionV) else: return "