2023-01-28 21:08:47 -08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import gevent.monkey
|
|
|
|
gevent.monkey.patch_all()
|
|
|
|
|
2025-07-29 12:50:35 -07:00
|
|
|
import pathlib
|
2023-02-13 13:39:44 -08:00
|
|
|
import sys
|
2025-07-29 12:50:35 -07:00
|
|
|
import threading
|
2023-02-13 13:39:44 -08:00
|
|
|
|
2023-01-28 21:08:47 -08:00
|
|
|
import flask
|
|
|
|
from gevent.pywsgi import WSGIServer
|
|
|
|
|
2025-08-05 17:57:43 -07:00
|
|
|
from pylocal import core, actions, dev, items, tick
|
2025-07-29 12:50:35 -07:00
|
|
|
|
|
|
|
sig_exit = threading.Event()
|
2023-01-28 21:08:47 -08:00
|
|
|
|
|
|
|
@core.app.route("/")
|
|
|
|
def index():
|
|
|
|
if not core.base_context_live:
|
|
|
|
core.render_base_context()
|
2025-07-29 12:50:35 -07:00
|
|
|
core.base_context["scripts"].append(core.app.url_for("static", filename="js/seagull-web.js"))
|
2023-01-28 21:08:47 -08:00
|
|
|
return flask.render_template("main_page.j2", **core.base_context)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
#core.app.run("0.0.0.0", 1337)
|
2023-02-13 13:39:44 -08:00
|
|
|
try:
|
|
|
|
http_server = WSGIServer(('', 80), core.app)
|
|
|
|
http_server.serve_forever()
|
|
|
|
except KeyboardInterrupt:
|
2025-07-29 12:50:35 -07:00
|
|
|
core.log.info("Goodnight, moon ...")
|
|
|
|
sig_exit.set()
|
2023-02-13 13:39:44 -08:00
|
|
|
sys.exit(0)
|