Spaces:
Sleeping
Sleeping
DmitrMakeev
commited on
Commit
•
e9edc80
1
Parent(s):
c3cea68
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
import flask
|
2 |
from flask import request, jsonify
|
|
|
3 |
import json
|
4 |
-
|
|
|
|
|
5 |
@app.route('/')
|
6 |
def index():
|
7 |
return flask.render_template('index.html')
|
|
|
8 |
@app.route("/avp", methods=["POST"])
|
9 |
def avp():
|
10 |
incoming = request.get_json()
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
# Возвращение измененного JSON в ответе сервера
|
16 |
-
return flask.jsonify(incoming)
|
17 |
if __name__ == '__main__':
|
18 |
-
app.run
|
|
|
1 |
import flask
|
2 |
from flask import request, jsonify
|
3 |
+
import os
|
4 |
import json
|
5 |
+
from dotenv import load_dotenv
|
6 |
+
load_dotenv()
|
7 |
+
app = flask.Flask(__name__, template_folder="./")
|
8 |
@app.route('/')
|
9 |
def index():
|
10 |
return flask.render_template('index.html')
|
11 |
+
|
12 |
@app.route("/avp", methods=["POST"])
|
13 |
def avp():
|
14 |
incoming = request.get_json()
|
15 |
+
print(incoming)
|
16 |
+
# Обработка POST запроса по пути "/avp"
|
17 |
+
response = {"bazis": incoming["bazis"]}
|
18 |
+
return jsonify(response)
|
|
|
|
|
19 |
if __name__ == '__main__':
|
20 |
+
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|