Add requirements.txt and guard app model imports in env.py

requirements.txt copied from shared_lib for Docker build compatibility.
Alembic env.py now uses try/except for app-specific model imports so
upgrade head works in Docker where only one app's code is present.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
giles
2026-02-11 13:16:04 +00:00
parent ef806f8fbb
commit 4dd25526b9
2 changed files with 52 additions and 4 deletions

View File

@@ -19,10 +19,11 @@ from shared.db.base import Base
# Import ALL models so Base.metadata sees every table
import shared.models # noqa: F401 User, KV, MagicLink, MenuItem, Ghost*
import blog.models # noqa: F401 Post, Author, Tag, Snippet, TagGroup
import market.models # noqa: F401 Product, CartItem, MarketPlace, etc.
import cart.models # noqa: F401 Order, OrderItem, PageConfig
import events.models # noqa: F401 Calendar, CalendarEntry, Ticket, etc.
for _mod in ("blog.models", "market.models", "cart.models", "events.models"):
try:
__import__(_mod)
except ImportError:
pass # OK in Docker — only needed for autogenerate
target_metadata = Base.metadata

47
requirements.txt Normal file
View File

@@ -0,0 +1,47 @@
starlette>=0.37,<0.39
aiofiles==25.1.0
aiosmtplib==5.0.0
alembic==1.17.0
anyio==4.11.0
async-timeout==5.0.1
asyncpg==0.30.0
beautifulsoup4==4.14.2
blinker==1.9.0
Brotli==1.1.0
certifi==2025.10.5
click==8.3.0
exceptiongroup==1.3.0
Flask==3.1.2
greenlet==3.2.4
h11==0.16.0
h2==4.3.0
hpack==4.1.0
httpcore==1.0.9
httpx==0.28.1
Hypercorn==0.17.3
hyperframe==6.1.0
idna==3.10
itsdangerous==2.2.0
Jinja2==3.1.6
lxml==6.0.2
Mako==1.3.10
MarkupSafe==3.0.3
priority==2.0.0
psycopg==3.2.11
psycopg-binary==3.2.11
PyJWT==2.10.1
PyYAML==6.0.3
Quart==0.20.0
sniffio==1.3.1
soupsieve==2.8
SQLAlchemy==2.0.44
taskgroup==0.2.2
tomli==2.3.0
typing_extensions==4.15.0
Werkzeug==3.1.3
wsproto==1.2.0
zstandard==0.25.0
redis>=5.0
mistune>=3.0
pytest>=8.0
pytest-asyncio>=0.23