Skip to content

Commit 0425cdd

Browse files
committed
improve startup and data handling
1 parent c3ee280 commit 0425cdd

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

main.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@
55
import os
66

77
if not os.path.exists("data"):
8-
os.makedirs("data")
8+
logger.warning("Could not find 'data' directory, verify bind mounts.")
9+
if os.path.exists(".nicegui"):
10+
logger.warning("Creating 'data' directory symlink.")
11+
os.symlink(".nicegui", "data", target_is_directory=True)
12+
else:
13+
logger.warning("Creating 'data' directory, settings will not be persistent.")
14+
os.makedirs("data")
15+
else:
16+
logger.warning("Found 'data' directory.")
917
os.environ.setdefault("NICEGUI_STORAGE_PATH", "data")
10-
from nicegui import ui # type: ignore
18+
19+
from nicegui import app, ui # type: ignore
1120

1221
ui.card.default_style("max-width: none")
1322
ui.card.default_props("flat bordered")
@@ -22,7 +31,8 @@
2231

2332

2433
if __name__ in {"__main__", "__mp_main__"}:
34+
app.on_startup(lambda: print(f"Starting bale, bound to the following addresses {', '.join(app.urls)}.", flush=True))
2535
page.build()
2636
s = scheduler.Scheduler()
2737
ui.timer(0.1, s.start, once=True)
28-
ui.run(title="bale", favicon=logo.favicon, dark=True, reload=False)
38+
ui.run(title="bale", favicon=logo.favicon, dark=True, reload=False, show=False, show_welcome_message=False)

0 commit comments

Comments
 (0)