mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
commit
4d356cda8d
7 changed files with 83 additions and 3 deletions
|
@ -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__":
|
||||
|
|
|
@ -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"]
|
||||
|
|
10
royalnet/web/blueprints/helloworld/__init__.py
Normal file
10
royalnet/web/blueprints/helloworld/__init__.py
Normal file
|
@ -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!"
|
10
royalnet/web/blueprints/home/__init__.py
Normal file
10
royalnet/web/blueprints/home/__init__.py
Normal 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")
|
16
royalnet/web/blueprints/home/templates/home.html
Normal file
16
royalnet/web/blueprints/home/templates/home.html
Normal 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 %}
|
13
royalnet/web/blueprints/testing/__init__.py
Normal file
13
royalnet/web/blueprints/testing/__init__.py
Normal file
|
@ -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'<body><script type="text/plain" style="display: block;">{repr(royals)}</script></body>'
|
30
royalnet/web/templates/base.html
Normal file
30
royalnet/web/templates/base.html
Normal 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>
|
Loading…
Reference in a new issue