Add blueprints
This commit is contained in:
parent
94aac14d81
commit
d51e445408
@ -13,6 +13,7 @@ def create_app():
|
||||
app.config.from_object('config.Config')
|
||||
configure_database(app)
|
||||
configure_admin(app)
|
||||
configure_blueprints(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
@ -94,3 +95,9 @@ def configure_admin(app):
|
||||
admin.add_view(ModelView(Location, 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)
|
7
worblehat/blueprints/main.py
Normal file
7
worblehat/blueprints/main.py
Normal 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")
|
16
worblehat/templates/base.html
Normal file
16
worblehat/templates/base.html
Normal 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>
|
7
worblehat/templates/main/index.html
Normal file
7
worblehat/templates/main/index.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block main %}
|
||||
|
||||
<h1>Forside worblehat</h1>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user