2021-07-05 19:37:05 +02:00
|
|
|
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2021-06-21 17:35:28 +02:00
|
|
|
import logging
|
2021-06-06 22:25:10 +02:00
|
|
|
import os
|
|
|
|
|
|
|
|
from dotenv import load_dotenv, find_dotenv
|
|
|
|
from flask import Flask
|
2021-06-21 22:21:25 +02:00
|
|
|
from flask_cors import CORS
|
2021-06-06 22:25:10 +02:00
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from flask_migrate import Migrate
|
|
|
|
|
|
|
|
load_dotenv(find_dotenv())
|
|
|
|
|
2021-06-21 17:35:28 +02:00
|
|
|
loglevel = os.getenv("KI_LOGLEVEL", logging.WARNING)
|
|
|
|
loglevel = int(loglevel)
|
|
|
|
logging.basicConfig(level=loglevel)
|
|
|
|
logging.debug("Hello from KI")
|
|
|
|
|
2021-06-06 22:25:10 +02:00
|
|
|
app = Flask(__name__)
|
2021-06-21 17:35:28 +02:00
|
|
|
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("SQLALCHEMY_DATABASE_URI")
|
|
|
|
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
2021-06-07 22:04:03 +02:00
|
|
|
app.config["KI_DATA_DIR"] = os.path.dirname(__file__) + "/data"
|
2021-06-12 13:24:26 +02:00
|
|
|
app.config["KI_AUTH"] = os.getenv("KI_AUTH")
|
2021-06-21 22:21:25 +02:00
|
|
|
app.config["CORS_ORIGINS"] = os.getenv("CORS_ORIGINS", "*")
|
|
|
|
|
|
|
|
CORS(app)
|
2021-06-06 22:25:10 +02:00
|
|
|
db = SQLAlchemy(app)
|
|
|
|
migrate = Migrate(app, db)
|
|
|
|
|
2021-07-05 19:37:05 +02:00
|
|
|
from ki import module # noqa
|