import sys
import os
import logging
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
try:
    from app import app, fetch_and_store
except ImportError as e:
    logging.basicConfig()
    logging.critical(f"No se pudo importar la aplicación Flask. Error: {e}")
    sys.exit(1)
if __name__ == "__main__":
    with app.app_context():
        fetch_and_store()
