-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
41 lines (32 loc) · 1.01 KB
/
app.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
29
30
31
32
33
34
35
36
37
38
39
40
41
from flask import Flask, render_template, session, redirect, request
from flask.helpers import url_for
from flask_socketio import SocketIO, emit, join_room, leave_room, rooms
app = Flask(__name__)
app.config['SECRET_KEY'] = 'pwsadwda'
socket_io = SocketIO(app)
pw = {
'awsdawd':'A-14'
}
@app.route('/.well-known/pki-validation/73CB797E44DA31859919D32AD4179231.txt')
def cert():
f = open('73CB797E44DA31859919D32AD4179231.txt', 'r')
data = f.read()
f.close()
return data
@app.route('/')
def f1():
if 'login' in session:
return render_template('main.html')
else:
return render_template('index.html')
@app.route('/login', methods=['POST'])
def login():
pwin = request.form['PW']
if pwin in pw:
session['login'] = True
session['BID'] = pw[pwin]
return redirect('/')
else:
return render_template('index.html', msg='비밀번호가 일치하지 않습니다.')
if __name__ == '__main__':
socket_io.run(app, host='0.0.0.0', port=80, debug=True)