Spaces:
Runtime error
Runtime error
DmitrMakeev
commited on
Commit
•
c9f3409
1
Parent(s):
b9003dd
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-
from flask import Flask, request, render_template_string
|
2 |
import sqlite3
|
|
|
3 |
import os
|
4 |
|
5 |
app = Flask(__name__, template_folder="./")
|
@@ -21,6 +22,9 @@ def init_db():
|
|
21 |
except Exception as e:
|
22 |
print(f"Error initializing database: {e}")
|
23 |
|
|
|
|
|
|
|
24 |
# Маршрут для обработки GET-запроса
|
25 |
@app.route('/add_contact', methods=['GET'])
|
26 |
def add_contact():
|
@@ -99,4 +103,4 @@ def show_contacts():
|
|
99 |
return "Internal Server Error", 500
|
100 |
|
101 |
if __name__ == '__main__':
|
102 |
-
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|
|
|
1 |
+
from flask import Flask, request, render_template_string, jsonify
|
2 |
import sqlite3
|
3 |
+
import requests
|
4 |
import os
|
5 |
|
6 |
app = Flask(__name__, template_folder="./")
|
|
|
22 |
except Exception as e:
|
23 |
print(f"Error initializing database: {e}")
|
24 |
|
25 |
+
# Вызов функции для инициализации базы данных
|
26 |
+
init_db()
|
27 |
+
|
28 |
# Маршрут для обработки GET-запроса
|
29 |
@app.route('/add_contact', methods=['GET'])
|
30 |
def add_contact():
|
|
|
103 |
return "Internal Server Error", 500
|
104 |
|
105 |
if __name__ == '__main__':
|
106 |
+
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|