add upload admins form
This commit is contained in:
16
app.py
16
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")
|
||||
|
||||
Reference in New Issue
Block a user