-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.py
91 lines (65 loc) · 2.32 KB
/
application.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#--------------FIRST SITE PROJECT---------------------
from flask import Flask
application=Flask(__name__)
#-----------------PAGES SETTINGS----------------------
@application.route("/")
def INDEX():
"""The main page of project"""
INDEXFILE="C:\\YOUR PATH\\First-site-Project\\INDEX.html" #Enter your path
INDEXOPEN=open(INDEXFILE,mode='r')
INDEXPAGE=INDEXOPEN.read()
INDEXOPEN.close()
return INDEXPAGE
@application.route("/help")
def HELP_PAGE():
"""Help page for users"""
HELPFILE="C:\\YOUR PATH\\First-site-Project\\HELPPAGE.html" #Enter your path
HELPOPEN=open(HELPFILE,mode='r')
HELPPAGE=HELPOPEN.read()
HELPOPEN.close()
return HELPPAGE
@application.route("/user")
def USER_PAGE():
"""Page of users"""
return "User's main page"
@application.route("/user/<USERNAME>")
def SHOW_USER_PAGE(USERNAME):
"""User's name"""
return "Hi!"+USERNAME.upper()
@application.route("/path")
def PATH_PAGE():
"""Path page"""
return "Please enter the subpath for this page"
@application.route("/path/<path:subpath>")
def SUBPATH_PAGE(subpath):
"""Print to the page Subpath"""
return "Subpath of user is: "+subpath
@application.route("/squared")
def SQUARED_MAIN_PAGE():
"""Squared page"""
return "Please enter to the subpath number you want to calculate"
@application.route("/squared/<int:X>")
def SQUARED_PAGE(X):
"""Calculate squared of user number"""
return "Squared number from: "+str(X)+" = "+str(X*X)
@application.route("/root")
def ROOT_MAIN_PAGE():
"""Route page"""
return "Please enter to the subpath number you want to root"
@application.route("/root/<int:Y>")
def ROOT_PAGE(Y):
"""Calculate root of user number"""
return "Root number from: "+str(Y)+" = "+str(int(Y**0.5))
@application.route("/contact")
def CONTACT_PAGE():
"""Contact page"""
return "GitHub profile: https://github.com/MatveyGuralskiy<p>Contact me: mathewguralskiy@gmail.com<p>"
@application.route("/about")
def ABOUT_PAGE():
"""About us page"""
return "<b><font color=red>My name is Matvey, I'm studying to become one day DevOps engineer</font><b>"
#---------------------MAIN----------------------------
if __name__=='__main__':
application.debug=True
application.env="FIRST SITE PROJECT"
application.run(host='0.0.0.0', port=5000)