-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp0.py
More file actions
31 lines (19 loc) · 735 Bytes
/
app0.py
File metadata and controls
31 lines (19 loc) · 735 Bytes
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
29
30
31
from flask import Flask, render_template, url_for, request
from datetime import datetime
from time_of_day0 import *
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/schedule', methods=['POST'])
def get_dog_info():
if request.method == 'POST':
result = request.form
name = result['name']
scheduled_time = datetime.strptime(result['time'], '%Y-%m-%dT%H:%M')
color = result['color']
time_of_day = get_time_of_day()
# needed for bad example to work
return render_template('schedule0.html', name = name, time = scheduled_time, color = color, time_of_day = time_of_day)
if __name__ == '__main__':
app.run(debug=True)