forked from kompetenzinventar/ki-backend
add logging
This commit is contained in:
parent
59de00527d
commit
3dcba71a6d
@ -21,7 +21,6 @@ rm data/ki.sqlite
|
|||||||
cp env.dev .env
|
cp env.dev .env
|
||||||
pipenv install --dev
|
pipenv install --dev
|
||||||
pipenv shell
|
pipenv shell
|
||||||
export FLASK_APP=app.py
|
|
||||||
flask db upgrade
|
flask db upgrade
|
||||||
flask seed
|
flask seed
|
||||||
flask run
|
flask run
|
||||||
|
10
app.py
10
app.py
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from dotenv import load_dotenv, find_dotenv
|
from dotenv import load_dotenv, find_dotenv
|
||||||
@ -7,9 +8,14 @@ from flask_migrate import Migrate
|
|||||||
|
|
||||||
load_dotenv(find_dotenv())
|
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 = Flask(__name__)
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv("SQLALCHEMY_DATABASE_URI")
|
app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("SQLALCHEMY_DATABASE_URI")
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||||
app.config["KI_DATA_DIR"] = os.path.dirname(__file__) + "/data"
|
app.config["KI_DATA_DIR"] = os.path.dirname(__file__) + "/data"
|
||||||
app.config["KI_AUTH"] = os.getenv("KI_AUTH")
|
app.config["KI_AUTH"] = os.getenv("KI_AUTH")
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
Loading…
Reference in New Issue
Block a user