diff --git a/app.py b/app.py index 5f54d56..8e62534 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,4 @@ # -*- coding: utf-8 -*- - -from turtle import st from flask import Flask, render_template, request, flash, redirect, url_for from werkzeug.utils import secure_filename import os @@ -28,7 +26,7 @@ db.init_app(app) def index(): #detals = PrintedDetal.query.all() - return render_template("index.html") # , detals=detals) + return render_template("index.html") # , detals=detals) @app.route("/admin", methods=['GET', 'POST']) @@ -37,15 +35,16 @@ def admipage(): if request.method == 'POST': logging.debug("POST QUERY loaded") - image_file = request.files['imgfile'] stl_file = request.files['stlfile'] - + logging.debug(image_file) logging.debug(stl_file) - image_file.save(os.path.join(app.config['UPLOAD_FOLDER'], image_file.filename)) - stl_file.save(os.path.join(app.config['UPLOAD_FOLDER2'], stl_file.filename)) + image_file.save(os.path.join( + app.config['UPLOAD_FOLDER'], image_file.filename)) + stl_file.save(os.path.join( + app.config['UPLOAD_FOLDER2'], stl_file.filename)) if request.form.get('isprinted') == 'on': isprinered = True @@ -56,22 +55,25 @@ def admipage(): logging.debug(stl_file) logging.debug(isprinered) - #detal = PrintedDetal(imgpath=image_file.filename, - # stlpath=stl_file.filename, + # detal = PrintedDetal(imgpath=image_file.filename, + # stlpath=stl_file.filename, # isprinted=isprinered) - #db.session.add(detal) - #db.session.commit() + # db.session.add(detal) + # db.session.commit() return render_template("adminpage.html") else: return render_template("adminpage.html") -@app.route('/uploader', methods = ['GET', 'POST']) + +@app.route('/uploader', methods=['GET', 'POST']) def upload_file(): - if request.method == 'POST': - f = request.files['file'] - f.save(secure_filename(f.filename)) - return 'file uploaded successfully' + if request.method == 'POST': + f = request.files['file'] + f.save(secure_filename(f.filename)) + return 'file uploaded successfully' + + if __name__ == "__main__": app.run(host="0.0.0.0", debug="True", port="3800") diff --git a/models.py b/models.py index 844d3bf..ae6c750 100644 --- a/models.py +++ b/models.py @@ -8,4 +8,5 @@ class PrintedDetal(db.Model): id = db.Column(db.Integer, primary_key=True, autoincrement=True) imgpath = db.Column(db.String(3000)) stlpath = db.Column(db.String(3000)) + srcpath = db.Column(db.String(3000)) isprinted = db.Column(db.Boolean()) \ No newline at end of file diff --git a/static/img/uploads/Снимок экрана от 2022-08-13 23-34-08.png b/static/img/uploads/Снимок экрана от 2022-08-13 23-34-08.png deleted file mode 100644 index 54d7347..0000000 Binary files a/static/img/uploads/Снимок экрана от 2022-08-13 23-34-08.png and /dev/null differ diff --git a/static/img/uploads/Снимок экрана от 2022-08-26 00-34-03.png b/static/img/uploads/Снимок экрана от 2022-08-26 00-34-03.png deleted file mode 100644 index 49660e3..0000000 Binary files a/static/img/uploads/Снимок экрана от 2022-08-26 00-34-03.png and /dev/null differ diff --git a/static/img/uploads/Снимок экрана от 2022-10-23 15-22-34.png b/static/img/uploads/Снимок экрана от 2022-10-23 15-22-34.png deleted file mode 100644 index d76b286..0000000 Binary files a/static/img/uploads/Снимок экрана от 2022-10-23 15-22-34.png and /dev/null differ diff --git a/static/img/uploads/Снимок экрана от 2022-10-23 20-43-35.png b/static/img/uploads/Снимок экрана от 2022-10-23 20-43-35.png deleted file mode 100644 index 3daeb53..0000000 Binary files a/static/img/uploads/Снимок экрана от 2022-10-23 20-43-35.png and /dev/null differ diff --git a/static/stl/Снимок экрана от 2022-09-18 11-26-36.png b/static/stl/Снимок экрана от 2022-09-18 11-26-36.png deleted file mode 100644 index 237fcc9..0000000 Binary files a/static/stl/Снимок экрана от 2022-09-18 11-26-36.png and /dev/null differ diff --git a/templates/adminpage.html b/templates/adminpage.html index 9471ab8..8406d46 100644 --- a/templates/adminpage.html +++ b/templates/adminpage.html @@ -31,10 +31,6 @@ - - - -