fix: absolute path bug
This commit is contained in:
parent
f96c9f7f89
commit
8870667064
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
import variables as var
|
||||
@ -8,9 +9,10 @@ lang_dict = {}
|
||||
|
||||
def load_lang(lang):
|
||||
global lang_dict, default_lang_dict
|
||||
with open("lang/en_US.json", "r") as f:
|
||||
root_dir = os.path.dirname(__file__)
|
||||
with open(os.path.join(root_dir, "lang/en_US.json"), "r") as f:
|
||||
default_lang_dict = json.load(f)
|
||||
with open(f"lang/{lang}.json", "r") as f:
|
||||
with open(os.path.join(root_dir, f"lang/{lang}.json"), "r") as f:
|
||||
lang_dict = json.load(f)
|
||||
|
||||
|
||||
|
@ -225,7 +225,8 @@ def get_all_dirs():
|
||||
@web.route("/", methods=['GET'])
|
||||
@requires_auth
|
||||
def index():
|
||||
return open(f"templates/index.{var.language}.html", "r").read()
|
||||
root_dir = os.path.dirname(__file__)
|
||||
return open(os.path.join(root_dir, f"templates/index.{var.language}.html"), "r").read()
|
||||
|
||||
|
||||
@web.route("/playlist", methods=['GET'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user