1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Create test home page?

This commit is contained in:
Steffo 2019-06-02 00:56:03 +02:00
parent bf0d6da143
commit e9c9673e6e
7 changed files with 63 additions and 6 deletions

View file

@ -1,6 +1,6 @@
import os import os
from .web import create_app from .web import create_app
from .web.blueprints import helloworld, testing from .web.blueprints import home
class TestConfig: class TestConfig:
@ -8,7 +8,7 @@ class TestConfig:
REQUIRED_TABLES = set() REQUIRED_TABLES = set()
app = create_app(TestConfig, [helloworld, testing]) app = create_app(TestConfig, [home])
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -1,4 +1,5 @@
from .helloworld import bp as helloworld from .helloworld import bp as helloworld
from .testing import bp as testing from .testing import bp as testing
from .home import bp as home
__all__ = ["helloworld", "testing"] __all__ = ["helloworld", "testing", "home"]

View file

@ -6,5 +6,5 @@ bp = Royalprint("helloworld", __name__, url_prefix="/helloworld")
@bp.route("/") @bp.route("/")
def helloworld(): def helloworld_index():
return "Hello world!" return "Hello world!"

View file

@ -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")

View file

@ -0,0 +1,16 @@
{% extends "base.html" %}
{% block title %}
Home
{% endblock %}
{% block content %}
<div class="doublebox">
<div class="top">
<span class="left">Ciao!</span>
</div>
<div class="bot">
Ciao!
</div>
</div>
{% endblock %}

View file

@ -7,7 +7,7 @@ bp = Royalprint("testing", __name__, url_prefix="/testing", required_tables={Roy
@bp.route("/listroyals") @bp.route("/listroyals")
def listroyals(): def testing_listroyals():
from ..alchemyhandler import alchemy, alchemy_session from ...alchemyhandler import alchemy, alchemy_session
royals = alchemy_session.query(alchemy.Royal).all() royals = alchemy_session.query(alchemy.Royal).all()
return f'<body><script type="text/plain" style="display: block;">{repr(royals)}</script></body>' return f'<body><script type="text/plain" style="display: block;">{repr(royals)}</script></body>'

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="it">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Stefano Pigozzi">
<meta name="keywords" content="Royal Games,RYG,Gaming,Videogames,Community">
<meta name="description" content="Royal Games Community">
<meta property="og:site_name" content="Royal Games">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css">
<link rel="stylesheet" href="https://steffo.eu/static/styling.css">
<link rel="icon" href="{{ url_for("static", filename="favicon.png") }}" type="image/png">
</head>
<body>
<!--TODO: togliere questa roba-->
<div id="top-bar">
<span id="steffo">
Royal Games
</span>
</div>
<div class="h-container">
{% block content %}{% endblock %}
</div>
<div id="foot-scripts">
{% block footscripts %}{% endblock %}
</div>
</body>
</html>