Add blueprints

This commit is contained in:
Felix Albrigtsen 2022-08-27 18:58:58 +02:00
parent 94aac14d81
commit d51e445408
4 changed files with 37 additions and 0 deletions

View File

@ -13,6 +13,7 @@ def create_app():
app.config.from_object('config.Config') app.config.from_object('config.Config')
configure_database(app) configure_database(app)
configure_admin(app) configure_admin(app)
configure_blueprints(app)
@app.route('/') @app.route('/')
def index(): def index():
@ -94,3 +95,9 @@ def configure_admin(app):
admin.add_view(ModelView(Location, db_session)) admin.add_view(ModelView(Location, db_session))
admin.add_view(ModelView(Bookcase, db_session)) admin.add_view(ModelView(Bookcase, db_session))
def configure_blueprints(app):
from worblehat.blueprints.main import main
blueprints = [main]
for bp in blueprints:
app.register_blueprint(bp)

View File

@ -0,0 +1,7 @@
from flask import Blueprint, render_template
main = Blueprint("main", __name__, template_folder="main")
@main.route('/')
def index():
return render_template("main/index.html")

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
{% block title %} Worblehat {% endblock %}
</title>
</head>
<body>
{% block main %}
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,7 @@
{% extends 'base.html' %}
{% block main %}
<h1>Forside worblehat</h1>
{% endblock %}