28 lines
842 B
Python
28 lines
842 B
Python
import atexit
|
|
import wesp_runtime_env
|
|
|
|
wesp_runtime_env.apply_kiosk_headless_env()
|
|
|
|
from app import create_app
|
|
from app.runtime_services import schedule_runtime_services
|
|
|
|
app = create_app()
|
|
|
|
if not app.config.get("TESTING"):
|
|
from app.services.mdns_service import register_mdns_shutdown
|
|
from app.services.startup_background import register_post_ready_callback
|
|
|
|
register_mdns_shutdown(app)
|
|
|
|
if app.config.get("WESP_DEFERRED_STARTUP"):
|
|
register_post_ready_callback(schedule_runtime_services)
|
|
else:
|
|
schedule_runtime_services(app)
|
|
|
|
if __name__ == "__main__":
|
|
from app.services.lan_network import parse_wesp_listen
|
|
|
|
listen_host, listen_port = parse_wesp_listen()
|
|
bind_host = "0.0.0.0" if listen_host in ("0.0.0.0", "::", "") else listen_host
|
|
app.run(host=bind_host, port=listen_port, debug=True)
|