-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (24 loc) · 696 Bytes
/
Copy pathmain.py
File metadata and controls
29 lines (24 loc) · 696 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
WeChat: cstutorcs
QQ: 749389476
Email: tutorcs@163.com
from flask import Flask, request
my320app = Flask("example-server")
donate_visits = 0
def count_donate():
donate_visits += 1
print("VISITER", donate_visits)
@my320app.route("/")
def home():
with open("index.html") as f:
html = f.read()
html = html.replace("XYZ", str(donate_visits))
return html
@my320app.route("/donate.html")
def donate():
count_donate()
return """<html><body style="background-color:lightblue">
<h1>Donations</h1>
Please make one!
<body></html>"""
if __name__ == '__main__':
my320app.run("0.0.0.0", "5000", debug=True, threaded=False)