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()
|
||||
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):
|
||||
try:
|
||||
path_config = "haproxy-webintarface.config"
|
||||
path_config = get_app_dir()+"/haproxy-webintarface.config"
|
||||
config = ConfigParser(interpolation=ExtendedInterpolation())
|
||||
config.read(path_config)
|
||||
except:
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sql
|
||||
import os, sys
|
||||
import http, cgi
|
||||
import funct
|
||||
import sql
|
||||
import glob
|
||||
import datetime
|
||||
import funct
|
||||
import sql
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
env = Environment(loader=FileSystemLoader('templates/'))
|
||||
template = env.get_template('logs.html')
|
||||
|
@ -52,7 +51,7 @@ except:
|
|||
|
||||
def get_files():
|
||||
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])]
|
||||
return sorted(file, reverse=True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue