Added wsgi support

This commit is contained in:
Benjamyn Love 2020-02-18 00:42:11 +11:00
parent 3d454b8e35
commit 9d7d26c657
2 changed files with 11 additions and 7 deletions

14
shop.py
View File

@ -117,11 +117,11 @@ def get_list_ids(user_id):
ret[lid] = name ret[lid] = name
return ret return ret
app = Flask(__name__) application = Flask(__name__)
app.config["DEBUG"] = True application.config["DEBUG"] = True
app.secret_key = b'*$#@U9423jr92jioJKL_)_;dasfj()12' application.secret_key = b'*$#@U9423jr92jioJKL_)_;dasfj()12'
@app.route('/') @application.route('/')
def index(): def index():
if session.get('id') is None: if session.get('id') is None:
data = {"title":"Login"} data = {"title":"Login"}
@ -138,7 +138,7 @@ def index():
return render_template('mobile.html', data=data) return render_template('mobile.html', data=data)
return render_template('index.html', data=data) return render_template('index.html', data=data)
@app.route('/post', methods=['POST']) @application.route('/post', methods=['POST'])
def handle_data(): def handle_data():
if "addValue" in request.form: if "addValue" in request.form:
for x in request.form: for x in request.form:
@ -189,7 +189,7 @@ def handle_data():
return redirect(url_for('index')) return redirect(url_for('index'))
@app.route("/admin") @application.route("/admin")
def admin(): def admin():
if session.get('id') is None: if session.get('id') is None:
data = {"title":"Login"} data = {"title":"Login"}
@ -205,4 +205,4 @@ def admin():
if __name__ == '__main__': if __name__ == '__main__':
doesTableExist() doesTableExist()
app.run(host="0.0.0.0") application.run(host="0.0.0.0")

4
wsgi.py Normal file
View File

@ -0,0 +1,4 @@
from shop import application
if "__main__" == __name__:
application.run()