db modifications

This commit is contained in:
DarkPete 2018-12-12 08:11:04 +01:00
parent c2cee15a6f
commit ab205f316b
2 changed files with 9 additions and 5 deletions

13
App.py
View File

@ -3,13 +3,13 @@ from flask import Flask, render_template, session, request, redirect, flash, g
import os import os
import sqlite3 import sqlite3
DATABASE = 'schema.sql' DATABASE = 'inquire.db'
app = Flask(__name__) app = Flask(__name__)
with app.app_context():
db = g._database = sqlite3.connect(DATABASE)
@app.route('/') @app.route('/')
def home(): def home():
@ -56,9 +56,14 @@ def logout():
def upvote(): def upvote():
if request.method == 'POST': if request.method == 'POST':
print("upvoted") print("upvoted")
with app.app_context():
db = g._database = sqlite3.connect(DATABASE)
db.execute("select * from user;")
print(db.fetchone())
return '200' return '200'
if __name__ == '__main__': if __name__ == '__main__':
app.secret_key = os.urandom(12) app.secret_key = os.urandom(12)
app.run(host='0.0.0.0', debug = True) app.run(host='0.0.0.0', debug = True)

1
xd
View File

@ -1 +0,0 @@
xd