From 46a604054cae191884e5b476666a58b4a0595447 Mon Sep 17 00:00:00 2001 From: "tets@test.test" Date: Mon, 24 Oct 2022 01:16:52 +0300 Subject: [PATCH] add upload admins form --- app.py | 16 ++++++-- static/css/index.css | 49 ----------------------- templates/index.html | 95 +++++++++++++++++++++++--------------------- 3 files changed, 61 insertions(+), 99 deletions(-) delete mode 100644 static/css/index.css diff --git a/app.py b/app.py index 051decd..a83555a 100644 --- a/app.py +++ b/app.py @@ -26,8 +26,6 @@ db.init_app(app) @app.route("/") def index(): - print(app.config['UPLOAD_FOLDER2']) - print(type(app.config['UPLOAD_FOLDER'])) detals = PrintedDetal.query.all() return render_template("index.html", detals=detals) @@ -35,11 +33,16 @@ def index(): @app.route("/admin", methods=['GET', 'POST']) def admipage(): - + logging.debug("adminpage loaded") if request.method == 'POST': + logging.debug("POST QUERY loaded") + image_file = request.files['images'] stl_file = request.files['stl'] + + 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)) @@ -60,6 +63,11 @@ def admipage(): else: return render_template("adminpage.html") - +@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 __name__ == "__main__": app.run(host="0.0.0.0", debug="True", port="3800") diff --git a/static/css/index.css b/static/css/index.css deleted file mode 100644 index 2d981c0..0000000 --- a/static/css/index.css +++ /dev/null @@ -1,49 +0,0 @@ -body{ - background-color: rgb(166, 253, 254); - -} -h1{ - text-align: center; -} -.tableH{ - - background-color: antiquewhite; -} -.tg { - border-collapse: collapse; - border-spacing: 0; - align-self: center; - width: 100%; -} - -.tg td { - border-color: black; - border-style: solid; - border-width: 1px; - font-family: Arial, sans-serif; - font-size: 14px; - overflow: hidden; - padding: 10px 5px; - word-break: normal; -} - -.tg th { - border-color: black; - border-style: solid; - border-width: 1px; - font-family: Arial, sans-serif; - font-size: 14px; - font-weight: normal; - overflow: hidden; - padding: 10px 5px; - word-break: normal; - -} - -.tg .tg-0lax { - text-align: center; - vertical-align: top; - border-radius: 100px; - border-radius: 100px; - -} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 886f770..b9bf277 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,54 +2,57 @@ - - - - - 3dprintered + + + + + + 3d Detals - -

Напечатанные детали

-
+
+

Каталог печатных 3д деталей

+
+
+
+ + {% for i in range(10) %} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Изображения Напечатано лиSTL file
-
+ + + +
+
+ 1 image +
+ +
+ +
+
+ +
+
+
+ + +
+
+
{{ i }}
+
+
+
+
+
+ + + {%endfor%} + + - \ No newline at end of file