def content(): def_name = sys._getframe().f_code.co_name name = request.form.get('name') if name: writejson('config.json', str(def_name), name) else: print('it is none') print('hello, I_m here0') print('look:', name, type(name)) try: def_name = readjson('config.json', str(def_name)) except: def_name = '' #print(sender) template = ''' <!DOCTYPE html> <html lang="en"><head> <meta charset="UTF-8"> <title>from_test</title></head> <body><form method="post" action=content> 例如 某地机房温湿度检测报警 :<input type="text" name="name"/> <input type="submit" value="Submit"/></form> <br><a href="../login_ok">Back</a></br> </body> </html> ''' return '当前值设定为:' + str(def_name) + template
def hum_max(): name = request.form.get('name') if name: writejson('config.json', 'hum_max', name) else: print('it is none') print('hello, I_m here0') print('look:', name, type(name)) hum_max = readjson('config.json', 'hum_max') print(hum_max) template = ''' <!DOCTYPE html> <html lang="en"><head> <meta charset="UTF-8"> <title>from_test</title></head> <body><form method="post" action="hum_max"> 湿度报警值(百分比)输入例如 70,80,90:<input type="text" name="name"/> <input type="submit" value="Submit"/></form> <br><a href="../">Back</a></br> </body> </html> ''' return '当前值设定为:' + str(hum_max) + template
def ntp_server(): name = request.form.get('name') if name: writejson('config.json', 'ntp_server', name) else: print('it is none') print('hello, I_m here0') print('look:', name, type(name)) ntp_server = readjson('config.json', 'ntp_server') print(ntp_server) template = ''' <!DOCTYPE html> <html lang="en"><head> <meta charset="UTF-8"> <title>from_test</title></head> <body><form method="post" action="ntp_server"> NTP server 例如 10.102.10.1:<input type="text" name="name"/> <input type="submit" value="Submit"/></form> <br><a href="../login_ok">Back</a></br> </body> </html> ''' return '当前值设定为:' + str(ntp_server) + template
def tem_max(): #name=str(random.random()) name = request.form.get('name') if name: writejson('config.json', 'tem_max', name) else: print('it is none') print('hello, I_m here0') print('look:', name, type(name)) tem_max = readjson('config.json', 'tem_max') print(tem_max) template = ''' <!DOCTYPE html> <html lang="en"><head> <meta charset="UTF-8"> <title>from_test</title></head> <body><form method="post" action="tem_max"> 温度报警值(摄氏度)输入例如 30,35,40:<input type="text" name="name"/> <input type="submit" value="Submit"/></form> <br><a href="../login_ok">Back</a></br> </body> </html> ''' return '当前值设定为:' + str(tem_max) + template