From 812ec627e83d4e0c562b23895af246783ce53582 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 1 Jun 2019 17:57:20 +0200 Subject: [PATCH] Una possibile idea che sto per eliminare --- royalnet/web/__init__.py | 0 royalnet/web/blueprints/__init__.py | 0 royalnet/web/flaskserver.py | 15 +++++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 royalnet/web/__init__.py create mode 100644 royalnet/web/blueprints/__init__.py create mode 100644 royalnet/web/flaskserver.py diff --git a/royalnet/web/__init__.py b/royalnet/web/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/royalnet/web/blueprints/__init__.py b/royalnet/web/blueprints/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/royalnet/web/flaskserver.py b/royalnet/web/flaskserver.py new file mode 100644 index 00000000..d1db0033 --- /dev/null +++ b/royalnet/web/flaskserver.py @@ -0,0 +1,15 @@ +import typing +import flask as f +from ..database import Alchemy + + +class RoyalFlask: + def __init__(self, config_obj: typing.Type): + self.app = f.Flask(__name__) + self.app.config.from_object(config_obj) + self.alchemy = Alchemy(self.app.config["RF_DATABASE_URI"], self.app.config["RF_REQUIRED_TABLES"]) + for blueprint in self.app.config["RF_BLUEPRINTS"]: + self.app.register_blueprint(blueprint) + + def debug(self): + self.app.run(host="127.0.0.1", port=1234, debug=True)