diff --git a/.vscode/settings.json b/.vscode/settings.json index c8d8f59..4f161bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "python.pythonPath": "${workspaceFolder}/venv/bin/python" + "python.pythonPath": "${workspaceFolder}/venv/bin/python", + "python.linting.pylintEnabled": false } \ No newline at end of file diff --git a/App.py b/App.py index 0b24eeb..cfa11d8 100644 --- a/App.py +++ b/App.py @@ -8,9 +8,11 @@ DATABASE = 'inquire.db' app = Flask(__name__) - - - +''' +with app.app_context(): + db = g._database = sqlite3.connect(DATABASE) + db_conn = db.cursor() +''' @app.route('/') def home(): if not session.get('logged_in'): @@ -23,13 +25,15 @@ def home(): @app.route('/student',methods=['GET', 'POST']) def student(): + return render_template('student.html') + +@app.route('/ask', methods=['POST']) +def do_add(): if request.method == 'POST': question = request.get_data().decode("utf-8") question = question.split('=') print(question[1]) return '200' - else: - return render_template('student.html') @app.route('/lecturer') def lecturer(): @@ -54,13 +58,13 @@ def logout(): @app.route('/upvote', methods=['POST']) def upvote(): - if request.method == 'POST': - print("upvoted") - with app.app_context(): - db = g._database = sqlite3.connect(DATABASE) - db.execute("select * from user;") - print(db.fetchone()) - return '200' + print("upvoted") + db = sqlite3.connect(DATABASE) + #db.row_factory = sql.Row + db_conn = db.cursor() + db_conn.execute("select * from user;") + print(db_conn.fetchone()) + return '200' if __name__ == '__main__':