-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
50 lines (38 loc) · 1.07 KB
/
app.py
File metadata and controls
50 lines (38 loc) · 1.07 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Main entry point for the Bingo application.
"""
import logging
import os
from fastapi.staticfiles import StaticFiles
from nicegui import app, ui
from src.config.constants import FREE_SPACE_TEXT, HEADER_TEXT
from src.core.game_logic import (
bingo_patterns,
board,
board_iteration,
clicked_tiles,
generate_board,
is_game_closed,
today_seed,
)
from src.ui.routes import init_routes
from src.utils.file_operations import read_phrases_file
# Set up logging
logging.basicConfig(
level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s"
)
# Initialize the application
def init_app():
"""Initialize the Bingo application."""
# Initialize game state
phrases = read_phrases_file()
generate_board(board_iteration, phrases)
# Initialize routes
init_routes()
# Mount the static directory
app.mount("/static", StaticFiles(directory="static"), name="static")
return app
if __name__ in {"__main__", "__mp_main__"}:
# Run the NiceGUI app
init_app()
ui.run(port=8080, title=f"{HEADER_TEXT}", dark=False)