diff --git a/royalnet/royalgamesweb.py b/royalnet/royalgamesweb.py index 3600844f..9411ac95 100644 --- a/royalnet/royalgamesweb.py +++ b/royalnet/royalgamesweb.py @@ -1,6 +1,6 @@ import os from .web import create_app -from .web.blueprints import helloworld, testing +from .web.blueprints import home class TestConfig: @@ -8,7 +8,7 @@ class TestConfig: REQUIRED_TABLES = set() -app = create_app(TestConfig, [helloworld, testing]) +app = create_app(TestConfig, [home]) if __name__ == "__main__": diff --git a/royalnet/web/blueprints/__init__.py b/royalnet/web/blueprints/__init__.py index 24f425d8..aa8d16bd 100644 --- a/royalnet/web/blueprints/__init__.py +++ b/royalnet/web/blueprints/__init__.py @@ -1,4 +1,5 @@ from .helloworld import bp as helloworld from .testing import bp as testing +from .home import bp as home -__all__ = ["helloworld", "testing"] +__all__ = ["helloworld", "testing", "home"] diff --git a/royalnet/web/blueprints/helloworld/__init__.py b/royalnet/web/blueprints/helloworld/__init__.py new file mode 100644 index 00000000..21228d40 --- /dev/null +++ b/royalnet/web/blueprints/helloworld/__init__.py @@ -0,0 +1,10 @@ +import flask as f +from ... import Royalprint + + +bp = Royalprint("helloworld", __name__, url_prefix="/helloworld") + + +@bp.route("/") +def helloworld_index(): + return "Hello world!" diff --git a/royalnet/web/blueprints/home/__init__.py b/royalnet/web/blueprints/home/__init__.py new file mode 100644 index 00000000..d37e547e --- /dev/null +++ b/royalnet/web/blueprints/home/__init__.py @@ -0,0 +1,10 @@ +import flask as f +from ... import Royalprint + + +bp = Royalprint("home", __name__, template_folder="templates") + + +@bp.route("/") +def home_index(): + return f.render_template("home.html") diff --git a/royalnet/web/blueprints/home/templates/home.html b/royalnet/web/blueprints/home/templates/home.html new file mode 100644 index 00000000..d6fb2d08 --- /dev/null +++ b/royalnet/web/blueprints/home/templates/home.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block title %} + Home +{% endblock %} + +{% block content %} +
+
+ Ciao! +
+
+ Ciao! +
+
+{% endblock %} \ No newline at end of file diff --git a/royalnet/web/blueprints/testing/__init__.py b/royalnet/web/blueprints/testing/__init__.py new file mode 100644 index 00000000..5f3fd3a5 --- /dev/null +++ b/royalnet/web/blueprints/testing/__init__.py @@ -0,0 +1,13 @@ +import flask as f +from ... import Royalprint +from ....database.tables import Royal + + +bp = Royalprint("testing", __name__, url_prefix="/testing", required_tables={Royal}) + + +@bp.route("/listroyals") +def testing_listroyals(): + from ...alchemyhandler import alchemy, alchemy_session + royals = alchemy_session.query(alchemy.Royal).all() + return f'' diff --git a/royalnet/web/templates/base.html b/royalnet/web/templates/base.html new file mode 100644 index 00000000..4445b56d --- /dev/null +++ b/royalnet/web/templates/base.html @@ -0,0 +1,30 @@ + + + + + + + + + + + {% block title %}{% endblock %} + + + + + + +
+ + Royal Games + +
+
+ {% block content %}{% endblock %} +
+
+ {% block footscripts %}{% endblock %} +
+ + \ No newline at end of file