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("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
print(app.config['UPLOAD_FOLDER2'])
|
|
||||||
print(type(app.config['UPLOAD_FOLDER']))
|
|
||||||
detals = PrintedDetal.query.all()
|
detals = PrintedDetal.query.all()
|
||||||
|
|
||||||
return render_template("index.html", detals=detals)
|
return render_template("index.html", detals=detals)
|
||||||
@@ -35,12 +33,17 @@ def index():
|
|||||||
|
|
||||||
@app.route("/admin", methods=['GET', 'POST'])
|
@app.route("/admin", methods=['GET', 'POST'])
|
||||||
def admipage():
|
def admipage():
|
||||||
|
logging.debug("adminpage loaded")
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
|
logging.debug("POST QUERY loaded")
|
||||||
|
|
||||||
|
|
||||||
image_file = request.files['images']
|
image_file = request.files['images']
|
||||||
stl_file = request.files['stl']
|
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))
|
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))
|
stl_file.save(os.path.join(app.config['UPLOAD_FOLDER2'], stl_file.filename))
|
||||||
|
|
||||||
@@ -60,6 +63,11 @@ def admipage():
|
|||||||
else:
|
else:
|
||||||
return render_template("adminpage.html")
|
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__":
|
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")
|
||||||
|
|||||||
@@ -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;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -5,51 +5,54 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/index.css')}}">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
<title>3dprintered </title>
|
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css')}}">
|
||||||
|
<title>3d Detals</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1> Напечатанные детали </h1>
|
<header>
|
||||||
<div class="tableH">
|
<h1 class="h1header"> Каталог печатных 3д деталей </h1>
|
||||||
|
</header>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
<table class="tg">
|
{% for i in range(10) %}
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th class="tg-0lax">№ </th>
|
|
||||||
<th class="tg-0lax">Изображения</th>
|
|
||||||
<th class="tg-0lax"> Напечатано ли</th>
|
<div class="col-md-4">
|
||||||
<th class="tg-0lax">STL file</th>
|
<div class="card">
|
||||||
</tr>
|
<img class="card-img-top" src="{{ url_for('static', filename='img/{{i}}.jpg')}} " alt="1 image">
|
||||||
</thead>
|
<div class="card-body">
|
||||||
<tbody>
|
<dv class="row">
|
||||||
<tr>
|
<div class="col">
|
||||||
<td class="tg-0lax"></td>
|
<button class="btn btn-block">Скачать исходник</button>
|
||||||
<td class="tg-0lax"></td>
|
</div>
|
||||||
<td class="tg-0lax"></td>
|
<div class="col">
|
||||||
<td class="tg-0lax"></td>
|
<button class="btn btn-block">Скачать stl </button>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
<div class="row">
|
||||||
<td class="tg-0lax"></td>
|
<div class="col d-flex justify-content-center">
|
||||||
<td class="tg-0lax"></td>
|
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
|
||||||
<td class="tg-0lax"></td>
|
<label class="form-check-label" for="flexCheckDefault">
|
||||||
<td class="tg-0lax"></td>
|
Напечатано
|
||||||
</tr>
|
</label>
|
||||||
<tr>
|
</div>
|
||||||
<td class="tg-0lax"></td>
|
<div class="col d-flex justify-content-center">
|
||||||
<td class="tg-0lax"></td>
|
<h5> {{ i }} </h5>
|
||||||
<td class="tg-0lax"></td>
|
</div>
|
||||||
<td class="tg-0lax"></td>
|
</div>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
</div>
|
||||||
<td class="tg-0lax"></td>
|
|
||||||
<td class="tg-0lax"></td>
|
|
||||||
<td class="tg-0lax"></td>
|
|
||||||
<td class="tg-0lax"></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
|
|
||||||
|
|
||||||
|
{%endfor%}
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user