Skip to content

Commit

Permalink
Move logging dir to app config
Browse files Browse the repository at this point in the history
  • Loading branch information
AetherUnbound authored and sea-kelp committed May 18, 2022
1 parent 5f0849a commit 81d3e15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/app.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import logging
import os
from pathlib import Path

from flask import Flask

from app.config import Config


LOGGING_DIR = Path(os.environ.get("LOGGING_DIR", ".data"))


def create_app():
app = Flask(__name__, static_folder="static", template_folder="templates")

Expand All @@ -18,7 +13,10 @@ def create_app():
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True

logging.basicConfig(filename=LOGGING_DIR / "application.log", level=logging.INFO)
logging.basicConfig(
filename=app.config["LOGGING_DIR"] / "application.log",
level=logging.INFO,
)

with app.app_context():
from .models import db
Expand Down
2 changes: 2 additions & 0 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class Config:
SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(SQLITE_DB_DIR, "db.sqlite3")
SQLALCHEMY_TRACK_MODIFICATIONS = False

LOGGING_DIR = Path(os.environ.get("LOGGING_DIR", ".data"))

REFRESH_INTERVAL = timedelta(hours=1)
RETRY_INTERVAL = timedelta(minutes=10)

Expand Down

0 comments on commit 81d3e15

Please sign in to comment.