mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Testing Python venv
This commit is contained in:
parent
5c588ea01a
commit
8d29cb7488
@ -35,6 +35,7 @@ dashboard_conf = 'wg-dashboard.ini'
|
||||
update = ""
|
||||
# Flask App Configuration
|
||||
app = Flask("WGDashboard")
|
||||
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 5206928
|
||||
app.secret_key = secrets.token_urlsafe(16)
|
||||
app.config['TEMPLATES_AUTO_RELOAD'] = True
|
||||
# Enable QR Code Generator
|
||||
@ -456,6 +457,7 @@ Flask Functions
|
||||
# Before request
|
||||
@app.before_request
|
||||
def auth_req():
|
||||
|
||||
conf = configparser.ConfigParser(strict=False)
|
||||
conf.read(dashboard_conf)
|
||||
req = conf.get("Server", "auth_req")
|
||||
@ -1255,4 +1257,13 @@ if __name__ == "__main__":
|
||||
app_port = config.get("Server", "app_port")
|
||||
wg_conf_path = config.get("Server", "wg_conf_path")
|
||||
config.clear()
|
||||
app.run(host=app_ip, debug=False, port=app_port)
|
||||
app.run(host=app_ip, debug=False, port=app_port)
|
||||
else:
|
||||
init_dashboard()
|
||||
update = check_update()
|
||||
config = configparser.ConfigParser(strict=False)
|
||||
config.read('wg-dashboard.ini')
|
||||
app_ip = config.get("Server", "app_ip")
|
||||
app_port = config.get("Server", "app_port")
|
||||
wg_conf_path = config.get("Server", "wg_conf_path")
|
||||
config.clear()
|
@ -48,13 +48,13 @@ install_wgd(){
|
||||
# set up the local environment
|
||||
_check_and_set_venv
|
||||
|
||||
python3 -m pip install -U -r requirements.txt > /dev/null 2>&1
|
||||
${VIRTUAL_ENV} -m pip install -U -r requirements.txt > /dev/null 2>&1
|
||||
printf "| WGDashboard installed successfully! |\n"
|
||||
|
||||
printf "| Preparing the systemctl unit file |\n"
|
||||
sed -i "s#{{APP_ROOT}}#${APP_ROOT}#" wg-dashboard.service
|
||||
sed -i "s#{{VIRTUAL_ENV}}#${VIRTUAL_ENV}#" wg-dashboard.service
|
||||
cat wg-dashboard.service | sudo SYSTEMD_EDITOR=tee systemctl edit --force --full wg-dashboard.service
|
||||
# cat wg-dashboard.service | sudo SYSTEMD_EDITOR=tee systemctl edit --force --full wg-dashboard.service
|
||||
systemctl daemon-reload
|
||||
printf "| Consider 'systemctl enable wg-dashboard' |\n"
|
||||
printf " and 'systemctl start wg-dashboard'\n"
|
||||
|
Loading…
Reference in New Issue
Block a user