-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflask_app.py
More file actions
30 lines (26 loc) · 1.01 KB
/
flask_app.py
File metadata and controls
30 lines (26 loc) · 1.01 KB
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
from flask import request, redirect, render_template, url_for, Flask, flash
import pymysql
from datetime import datetime
from weather import naver_com, accuweather_com, msn_com
from data_analize import analize
app = Flask(__name__)
conn = pymysql.connect(host='127.0.0.1', user='root', password='1234', db='tweather', charset='utf8')
curs = conn.cursor()
app.debug = True
@app.route('/')
def index():
naver_com.naver_weather()
accuweather_com.accuweather_com()
#msn_com.msn_com()
analize.start()
measure = datetime.date(datetime.today()) # 측정날짜
curs.execute('select * FROM naver WHERE measurement=%s',measure)
naver_data = curs.fetchall()
curs.execute('select * FROM accuweather WHERE measurement=%s',measure)
accu_data = curs.fetchall()
""" curs.execute('select * FROM msn WHERE measurement=%s',measure)
msn_data = curs.fetchall() """
conn.commit()
return render_template('index.html', naver_data=naver_data, accu_data=accu_data)
if __name__ == "__main__":
app.run()