add funct
This commit is contained in:
34
app.py
34
app.py
@@ -1,6 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from turtle import st
|
|
||||||
from flask import Flask, render_template, request, flash, redirect, url_for
|
from flask import Flask, render_template, request, flash, redirect, url_for
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
import os
|
import os
|
||||||
@@ -28,7 +26,7 @@ db.init_app(app)
|
|||||||
def index():
|
def index():
|
||||||
#detals = PrintedDetal.query.all()
|
#detals = PrintedDetal.query.all()
|
||||||
|
|
||||||
return render_template("index.html") # , detals=detals)
|
return render_template("index.html") # , detals=detals)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/admin", methods=['GET', 'POST'])
|
@app.route("/admin", methods=['GET', 'POST'])
|
||||||
@@ -37,15 +35,16 @@ def admipage():
|
|||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
logging.debug("POST QUERY loaded")
|
logging.debug("POST QUERY loaded")
|
||||||
|
|
||||||
|
|
||||||
image_file = request.files['imgfile']
|
image_file = request.files['imgfile']
|
||||||
stl_file = request.files['stlfile']
|
stl_file = request.files['stlfile']
|
||||||
|
|
||||||
logging.debug(image_file)
|
logging.debug(image_file)
|
||||||
logging.debug(stl_file)
|
logging.debug(stl_file)
|
||||||
|
|
||||||
image_file.save(os.path.join(app.config['UPLOAD_FOLDER'], image_file.filename))
|
image_file.save(os.path.join(
|
||||||
stl_file.save(os.path.join(app.config['UPLOAD_FOLDER2'], stl_file.filename))
|
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':
|
if request.form.get('isprinted') == 'on':
|
||||||
isprinered = True
|
isprinered = True
|
||||||
@@ -56,22 +55,25 @@ def admipage():
|
|||||||
logging.debug(stl_file)
|
logging.debug(stl_file)
|
||||||
logging.debug(isprinered)
|
logging.debug(isprinered)
|
||||||
|
|
||||||
#detal = PrintedDetal(imgpath=image_file.filename,
|
# detal = PrintedDetal(imgpath=image_file.filename,
|
||||||
# stlpath=stl_file.filename,
|
# stlpath=stl_file.filename,
|
||||||
# isprinted=isprinered)
|
# isprinted=isprinered)
|
||||||
#db.session.add(detal)
|
# db.session.add(detal)
|
||||||
#db.session.commit()
|
# db.session.commit()
|
||||||
|
|
||||||
return render_template("adminpage.html")
|
return render_template("adminpage.html")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return render_template("adminpage.html")
|
return render_template("adminpage.html")
|
||||||
|
|
||||||
@app.route('/uploader', methods = ['GET', 'POST'])
|
|
||||||
|
@app.route('/uploader', methods=['GET', 'POST'])
|
||||||
def upload_file():
|
def upload_file():
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
f = request.files['file']
|
f = request.files['file']
|
||||||
f.save(secure_filename(f.filename))
|
f.save(secure_filename(f.filename))
|
||||||
return 'file uploaded successfully'
|
return 'file uploaded successfully'
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", debug="True", port="3800")
|
app.run(host="0.0.0.0", debug="True", port="3800")
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ class PrintedDetal(db.Model):
|
|||||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
||||||
imgpath = db.Column(db.String(3000))
|
imgpath = db.Column(db.String(3000))
|
||||||
stlpath = db.Column(db.String(3000))
|
stlpath = db.Column(db.String(3000))
|
||||||
|
srcpath = db.Column(db.String(3000))
|
||||||
isprinted = db.Column(db.Boolean())
|
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 |
@@ -31,10 +31,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
|
integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3"
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user