generated from DuckyMomo20012/python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
33 lines (25 loc) · 864 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
33
import pytermgui as ptg
import yaml
from environs import Env
from mongoengine import connect
import routes
import session
from src.helpers.file import getSettingField
from src.helpers.page_manager import drawPage
env = Env()
# Read .env into os.environ
env.read_env()
connect(host=env.str("MONGODB_HOST"), uuidRepresentation="standard")
with ptg.WindowManager() as manager:
with open("styles.yaml") as file:
styles = file.read()
defaultStyles: dict = getSettingField("workbench.styles", {})
# If defaultStyles is not an empty dict
if defaultStyles:
styles = yaml.dump(defaultStyles, allow_unicode=True)
loader = ptg.YamlLoader()
loader.load(styles)
# Add navigation history stack
session.navigation = []
drawPage(manager, routes.routes["auth/login"]())
manager.run()