timezone fix

This commit is contained in:
Michael Beck 2025-06-13 11:14:06 +02:00
parent a7964a2f3d
commit 7fd403bd40
3 changed files with 15 additions and 3 deletions

View File

@ -8,9 +8,21 @@ from .blueprints import register_blueprints
from .scheduler import ScraperScheduler
def create_app(test_config=None):
app = Flask(__name__)
app = Flask(__name__, instance_relative_config=True)
app.config.from_object(Config)
# Ensure the instance folder exists
import os
try:
os.makedirs(app.instance_path)
except OSError:
pass
# Set the database URI to use absolute path if it's the default relative path
if app.config['SQLALCHEMY_DATABASE_URI'] == "sqlite:///instance/papers.db":
db_path = os.path.join(app.instance_path, 'papers.db')
app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{db_path}'
if test_config:
app.config.update(test_config)

View File

@ -3,7 +3,7 @@ import os
class Config:
SECRET_KEY = os.environ.get("SECRET_KEY", "dev")
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL", "sqlite:///papers.db")
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL", "sqlite:///instance/papers.db")
SQLALCHEMY_TRACK_MODIFICATIONS = False
APP_TITLE = os.environ.get("APP_TITLE", "SciPaperLoader")
SCRAPER_MODULE = os.environ.get("SCRAPER_MODULE", "dummy")

View File

@ -298,7 +298,7 @@ class ScraperScheduler:
jobstores=jobstores,
executors=executors,
job_defaults=job_defaults,
timezone='UTC'
timezone=None # Use system timezone instead of UTC
)
# Add event listeners