-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
32 lines (27 loc) · 834 Bytes
/
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
from flask import Flask
import yaml
from sync import sync
from web import web
try:
with open('config.yml', 'r', encoding='utf-8') as f:
config = yaml.load(f.read(), Loader=yaml.FullLoader)
except:
print("Failed to read config file.")
exit()
theme = config['web']['theme']
if theme is None:
theme = 'default'
app = Flask(__name__,static_url_path='/static', static_folder=f'static/{theme}/', template_folder=f'templates/{theme}')
app.register_blueprint(sync)
app.register_blueprint(web)
if __name__ == '__main__':
appPort = config["host"]["port"]
debug = config["host"]["debug"]
if debug is None:
debug = False
if appPort:
print(f"Host will run on port {appPort} sosu!")
else:
print(f"No specific port. Host will run on default 14514 sosu.")
appPort = 14514
app.run(port=appPort,debug=debug)