init frontend

This commit is contained in:
vincent 2021-05-26 13:56:20 +02:00
parent f83b3d5f82
commit 14e7203bca
3 changed files with 22 additions and 2 deletions

View File

@ -4,9 +4,10 @@ from logging.handlers import TimedRotatingFileHandler
from flask import Flask from flask import Flask
from pony.flask import Pony from pony.flask import Pony
from ITPlanning.api import api from ITPlanning.api import api
#from ITPlanning.frontend import frontend
from ITPlanning.db import init_database from ITPlanning.db import init_database
from ITPlanning.config import IniConfig from ITPlanning.config import IniConfig
from ITPlanning.frontend import frontend
logger = logging.getLogger("ITPlanning") logger = logging.getLogger("ITPlanning")
@ -29,7 +30,11 @@ def create_app():
logger.setLevel(getattr(logging, loglevel.upper(), logging.NOTSET)) logger.setLevel(getattr(logging, loglevel.upper(), logging.NOTSET))
# Initialize database # Initialize database
logger.warning(app.config["BASE"]["database_uri"])
init_database(app.config["BASE"]["database_uri"]) init_database(app.config["BASE"]["database_uri"])
Pony(app) Pony(app)
# create flask blueprint
app.register_blueprint(api, url_prefix="/api/v1")
app.register_blueprint(frontend)
return app return app

View File

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

View File

@ -0,0 +1,7 @@
<html>
<body>
ITPLANNING!
</body>
<html>