timezone fix
This commit is contained in:
parent
a7964a2f3d
commit
7fd403bd40
@ -8,9 +8,21 @@ from .blueprints import register_blueprints
|
|||||||
from .scheduler import ScraperScheduler
|
from .scheduler import ScraperScheduler
|
||||||
|
|
||||||
def create_app(test_config=None):
|
def create_app(test_config=None):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__, instance_relative_config=True)
|
||||||
app.config.from_object(Config)
|
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:
|
if test_config:
|
||||||
app.config.update(test_config)
|
app.config.update(test_config)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import os
|
|||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
SECRET_KEY = os.environ.get("SECRET_KEY", "dev")
|
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
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||||
APP_TITLE = os.environ.get("APP_TITLE", "SciPaperLoader")
|
APP_TITLE = os.environ.get("APP_TITLE", "SciPaperLoader")
|
||||||
SCRAPER_MODULE = os.environ.get("SCRAPER_MODULE", "dummy")
|
SCRAPER_MODULE = os.environ.get("SCRAPER_MODULE", "dummy")
|
||||||
|
@ -298,7 +298,7 @@ class ScraperScheduler:
|
|||||||
jobstores=jobstores,
|
jobstores=jobstores,
|
||||||
executors=executors,
|
executors=executors,
|
||||||
job_defaults=job_defaults,
|
job_defaults=job_defaults,
|
||||||
timezone='UTC'
|
timezone=None # Use system timezone instead of UTC
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add event listeners
|
# Add event listeners
|
||||||
|
Loading…
x
Reference in New Issue
Block a user