mirror of https://github.com/Aidaho12/haproxy-wi
parent
2715ecab29
commit
01fc3c49be
10
app/funct.py
10
app/funct.py
|
@ -11,9 +11,17 @@ from configparser import ConfigParser, ExtendedInterpolation
|
||||||
form = cgi.FieldStorage()
|
form = cgi.FieldStorage()
|
||||||
serv = form.getvalue('serv')
|
serv = form.getvalue('serv')
|
||||||
|
|
||||||
|
def get_app_dir():
|
||||||
|
d = sys.path[0]
|
||||||
|
d = d.split('/')[-1]
|
||||||
|
if d == "app":
|
||||||
|
return sys.path[0]
|
||||||
|
else:
|
||||||
|
return os.path.dirname(sys.path[0])
|
||||||
|
|
||||||
def get_config_var(sec, var):
|
def get_config_var(sec, var):
|
||||||
try:
|
try:
|
||||||
path_config = "haproxy-webintarface.config"
|
path_config = get_app_dir()+"/haproxy-webintarface.config"
|
||||||
config = ConfigParser(interpolation=ExtendedInterpolation())
|
config = ConfigParser(interpolation=ExtendedInterpolation())
|
||||||
config.read(path_config)
|
config.read(path_config)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os, sys
|
||||||
import sql
|
|
||||||
import http, cgi
|
import http, cgi
|
||||||
import funct
|
|
||||||
import sql
|
|
||||||
import glob
|
import glob
|
||||||
import datetime
|
import datetime
|
||||||
|
import funct
|
||||||
|
import sql
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
env = Environment(loader=FileSystemLoader('templates/'))
|
env = Environment(loader=FileSystemLoader('templates/'))
|
||||||
template = env.get_template('logs.html')
|
template = env.get_template('logs.html')
|
||||||
|
@ -52,7 +51,7 @@ except:
|
||||||
|
|
||||||
def get_files():
|
def get_files():
|
||||||
file = []
|
file = []
|
||||||
for files in glob.glob(os.path.join(log_path,'*.log')):
|
for files in glob.glob(os.path.join(log_path,'*.log*')):
|
||||||
file += [(files.split('/')[5], files.split('/')[5])]
|
file += [(files.split('/')[5], files.split('/')[5])]
|
||||||
return sorted(file, reverse=True)
|
return sorted(file, reverse=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue