-
Notifications
You must be signed in to change notification settings - Fork 2
/
app23.py
28 lines (21 loc) · 948 Bytes
/
app23.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from flask import Flask, request, render_template, jsonify
import json
app = Flask(__name__)
# Sample questions
questions = [
{'id': 1, 'question': 'Feeling nervous: Do you often feel nervous?'},
{'id': 2, 'question': 'Panic: Have you ever experienced a panic attack?'},
{'id': 3, 'question': 'Breathing rapidly: Do you find yourself breathing rapidly in certain situations?'},
{'id': 4, 'question': 'Sweating: Do you experience excessive sweating, even when it'},
{'id': 5, 'question': 'Trembling: Do you find yourself trembling in certain situations?'},
]
@app.route('/')
def index():
return render_template('./DisorderQuestions.html', questions=questions)
@app.route('/disorder_submit', methods=['POST'])
def disorder_submit():
answers = json.loads(request.form.get('answers'))
print(answers)
return jsonify({'status': 'success', 'answers': answers})
if __name__ == '__main__':
app.run(debug=True)