-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapp.py
39 lines (29 loc) · 1.26 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
#!/usr/bin/env python3.8
# -*- coding=utf-8 -*-
from flask import Flask, render_template
import os
from database.orm_search_data import get_all_users
import requests
# 默认目录为当前目录的templates
template_dir = os.path.abspath('./templates')
app = Flask(__name__, template_folder=template_dir)
app.debug = True
@app.route('/')
def index():
instance_id = requests.get("http://100.100.100.200/latest/meta-data/instance-id").text
region_id = requests.get("http://100.100.100.200/latest/meta-data/region-id").text
az_id = requests.get("http://100.100.100.200/latest/meta-data/zone-id").text
private_ipv4 = requests.get("http://100.100.100.200/latest/meta-data/private-ipv4").text
return render_template('index.html',
devnet_main='乾颐堂阿里云测试',
instance_id=instance_id,
region_id=region_id,
az_id=az_id,
private_ipv4=private_ipv4,
active='首页')
@app.route('/staff_info')
def staff_info():
staff_list = get_all_users()
return render_template('staff.html', staff_list=staff_list, active='员工信息')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)