Small fixes in app.py

This commit is contained in:
TT-392 2024-09-16 17:45:11 +02:00
parent 117efa3589
commit c4436d040b

10
app.py
View file

@ -7,8 +7,6 @@ from print import *
from format_image import * from format_image import *
import os import os
valid_height=800
app = Flask(__name__) app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = 'static/uploads' app.config['UPLOAD_FOLDER'] = 'static/uploads'
app.config['TEXT_FOLDER'] = 'static/text' app.config['TEXT_FOLDER'] = 'static/text'
@ -22,6 +20,10 @@ if not os.path.exists(app.config['TEXT_FOLDER']):
#TODO: make it so sessions don't interfere with eachother #TODO: make it so sessions don't interfere with eachother
@app.route('/', methods=['GET', 'POST'])
def base():
return render_template('base.html')
@app.route('/image', methods=['GET', 'POST']) @app.route('/image', methods=['GET', 'POST'])
def image(): def image():
if request.method == 'POST': if request.method == 'POST':
@ -51,7 +53,7 @@ def image():
#TODO: maybe merge some stuff with text-print #TODO: maybe merge some stuff with text-print
@app.route('/image-print', methods=['GET', 'POST']) @app.route('/image-print', methods=['GET', 'POST'])
def text_print(): def image_print():
if request.method == 'POST': if request.method == 'POST':
image = format_image_to_label(session["filepath"]) image = format_image_to_label(session["filepath"])
print_image(image) print_image(image)
@ -147,7 +149,7 @@ def text():
@app.route('/text-print', methods=['GET', 'POST']) @app.route('/text-print', methods=['GET', 'POST'])
def tex_print(): def text_print():
if request.method == 'POST': if request.method == 'POST':
image = format_image_to_label("static/text/text.png") image = format_image_to_label("static/text/text.png")
print_image(image) print_image(image)