mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +00:00
fix: normalize DATABASE_URL for Railway Postgres (postgres:// → postgresql+asyncpg://)
Railway Postgres gives postgres:// but SQLAlchemy asyncpg needs postgresql+asyncpg://. This was the root cause of all Railway crashes. https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
This commit is contained in:
parent
cbce696868
commit
0ffba2167c
@ -16,7 +16,14 @@ def _get_db_url() -> str:
|
||||
break
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
return url or "sqlite+aiosqlite:///./dealix.db"
|
||||
if not url:
|
||||
return "sqlite+aiosqlite:///./dealix.db"
|
||||
# Railway Postgres gives postgres:// but SQLAlchemy needs postgresql+asyncpg://
|
||||
if url.startswith("postgres://"):
|
||||
url = url.replace("postgres://", "postgresql+asyncpg://", 1)
|
||||
elif url.startswith("postgresql://"):
|
||||
url = url.replace("postgresql://", "postgresql+asyncpg://", 1)
|
||||
return url
|
||||
|
||||
|
||||
_DB_URL = _get_db_url()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user