add funct

This commit is contained in:
2022-10-29 20:33:12 +03:00
parent 32061c6804
commit 60f746b2ee
8 changed files with 19 additions and 20 deletions

20
app.py
View File

@@ -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
@@ -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,
# 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 __name__ == "__main__":
app.run(host="0.0.0.0", debug="True", port="3800")

View File

@@ -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())

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 482 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 KiB

View File

@@ -31,10 +31,6 @@
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
crossorigin="anonymous"></script>