forked from kompetenzinventar/ki-backend
33 lines
896 B
Python
33 lines
896 B
Python
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import logging
|
|
import os
|
|
|
|
from dotenv import load_dotenv, find_dotenv
|
|
from flask import Flask
|
|
from flask_cors import CORS
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_migrate import Migrate
|
|
|
|
load_dotenv(find_dotenv())
|
|
|
|
loglevel = os.getenv("KI_LOGLEVEL", logging.WARNING)
|
|
loglevel = int(loglevel)
|
|
logging.basicConfig(level=loglevel)
|
|
logging.debug("Hello from KI")
|
|
|
|
app = Flask(__name__)
|
|
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("SQLALCHEMY_DATABASE_URI")
|
|
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
|
app.config["KI_DATA_DIR"] = os.path.dirname(__file__) + "/data"
|
|
app.config["KI_AUTH"] = os.getenv("KI_AUTH")
|
|
app.config["CORS_ORIGINS"] = os.getenv("CORS_ORIGINS", "*")
|
|
|
|
CORS(app)
|
|
db = SQLAlchemy(app)
|
|
migrate = Migrate(app, db)
|
|
|
|
from ki import module # noqa
|