Spaces:
Sleeping
Sleeping
MD.Riad Rayhan commited on
Remove provisioning/device-owner endpoints; Device Admin only
Browse filesFiles changed (2)
9 unmodified lines10111213141516171819209 unmodified linesif db_url.startswith("postgres://"):db_url = db_url.replace("postgres://", "postgresql://", 1)# For SQLite, ensure the DB file is in a writable directoryif "sqlite" in db_url:engine = create_engine(db_url, connect_args={"check_same_thread": False})else:engine = create_engine(db_url)SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)9 unmodified lines1011121314151617181920212223242526272829309 unmodified linesif db_url.startswith("postgres://"):db_url = db_url.replace("postgres://", "postgresql://", 1)# For SQLite, store the DB file in a persistent directory when one is available.# Hugging Face Spaces (and many PaaS) expose a writable persistent mount at# /data. If it exists we put the SQLite file there so it survives container# rebuilds/redeploys. Otherwise we fall back to the local working directory.if "sqlite" in db_url:# Only relocate the default relative SQLite path, never an explicit absolute one.if db_url in ("sqlite:///./emi_locker.db", "sqlite:///emi_locker.db"):persistent_dir = "/data"if os.path.isdir(persistent_dir) and os.access(persistent_dir, os.W_OK):db_url = f"sqlite:///{persistent_dir}/emi_locker.db"engine = create_engine(db_url, connect_args={"check_same_thread": False})else:# Postgres / MySQL: pool_pre_ping avoids stale-connection errors on managed DBs.engine = create_engine(db_url, pool_pre_ping=True, pool_recycle=300)SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
8 unmodified lines910111213148 unmodified linesaiosqlite==0.19.0alembic==1.13.1cryptography==42.0.2# Redis and Celeryredis==5.0.18 unmodified lines91011121314158 unmodified linesaiosqlite==0.19.0alembic==1.13.1cryptography==42.0.2psycopg2-binary==2.9.9# Redis and Celeryredis==5.0.1
app/core/database.py+12-2
requirements.txt+1