22 lines
680 B
Python
22 lines
680 B
Python
""" flask apps initialisation """
|
|
import logging
|
|
from flask import Flask
|
|
from pony.flask import Pony
|
|
from ITPlanning.api import api
|
|
from ITPlanning.db import init_database, release_database
|
|
#from ITPlanning.frontend import frontend
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def create_app():
|
|
app=Flask(__name__, static_folder= "static",template_folder="view")
|
|
app.config.from_object("ITPlanning.config.DefaultConfig")
|
|
app.register_blueprint(api, url_prefix="/api/v1")
|
|
#app.register_blueprint(frontend)
|
|
|
|
# Initialize database
|
|
logger.warning(app.config["BASE"]["database_uri"])
|
|
init_database(app.config["BASE"]["database_uri"])
|
|
Pony(app)
|
|
return app
|