Update app.py
Browse files
app.py
CHANGED
|
@@ -1129,6 +1129,45 @@ def online():
|
|
| 1129 |
return "EUR 22", 200
|
| 1130 |
return render_template('online.html')
|
| 1131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1132 |
@app.route('/se_mes_f_gc', methods=['GET'])
|
| 1133 |
def se_mes_f_gc():
|
| 1134 |
api_sys_control = request.args.get('api_sys')
|
|
|
|
| 1129 |
return "EUR 22", 200
|
| 1130 |
return render_template('online.html')
|
| 1131 |
|
| 1132 |
+
|
| 1133 |
+
|
| 1134 |
+
|
| 1135 |
+
|
| 1136 |
+
@app.route('/upload', methods=['POST'])
|
| 1137 |
+
def upload_file():
|
| 1138 |
+
if 'file' not in request.files:
|
| 1139 |
+
return "No file part", 400
|
| 1140 |
+
file = request.files['file']
|
| 1141 |
+
if file.filename == '':
|
| 1142 |
+
return "No selected file", 400
|
| 1143 |
+
|
| 1144 |
+
# Генерация уникального имени файла
|
| 1145 |
+
unique_filename = str(uuid.uuid4()) + os.path.splitext(file.filename)[1]
|
| 1146 |
+
save_path = os.path.join(UPLOAD_FOLDER, unique_filename)
|
| 1147 |
+
file.save(save_path)
|
| 1148 |
+
|
| 1149 |
+
# Возвращаем полный URL загруженного файла с протоколом https
|
| 1150 |
+
full_url = request.url_root.replace('http://', 'https://') + 'uploads/' + unique_filename
|
| 1151 |
+
return f"File uploaded successfully and saved to {full_url}", 200
|
| 1152 |
+
|
| 1153 |
+
@app.route('/uploads/<filename>', methods=['GET'])
|
| 1154 |
+
def uploaded_file(filename):
|
| 1155 |
+
return send_from_directory(UPLOAD_FOLDER, filename)
|
| 1156 |
+
|
| 1157 |
+
@app.route('/up_fa', methods=['GET'])
|
| 1158 |
+
def up_fa():
|
| 1159 |
+
return render_template('up_fa.html')
|
| 1160 |
+
|
| 1161 |
+
|
| 1162 |
+
|
| 1163 |
+
|
| 1164 |
+
|
| 1165 |
+
|
| 1166 |
+
|
| 1167 |
+
|
| 1168 |
+
|
| 1169 |
+
|
| 1170 |
+
|
| 1171 |
@app.route('/se_mes_f_gc', methods=['GET'])
|
| 1172 |
def se_mes_f_gc():
|
| 1173 |
api_sys_control = request.args.get('api_sys')
|