Fix worker crash: remove broken gunicorn post_fork hook
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+14
-12
@@ -60,6 +60,20 @@ def create_app(setup_database=True):
|
||||
|
||||
register_cli(app)
|
||||
|
||||
# Ensure models are registered even when DB setup runs in init_db.py.
|
||||
with app.app_context():
|
||||
from app.models import ( # noqa: F401
|
||||
AdBanner,
|
||||
Folder,
|
||||
FolderInvite,
|
||||
FolderMember,
|
||||
PasswordResetToken,
|
||||
Photo,
|
||||
SiteSettings,
|
||||
User,
|
||||
UserGroup,
|
||||
)
|
||||
|
||||
@app.context_processor
|
||||
def inject_banners():
|
||||
from app.banner_service import get_banners_by_position
|
||||
@@ -71,18 +85,6 @@ def create_app(setup_database=True):
|
||||
|
||||
if setup_database:
|
||||
with app.app_context():
|
||||
from app.models import ( # noqa: F401
|
||||
AdBanner,
|
||||
Folder,
|
||||
FolderInvite,
|
||||
FolderMember,
|
||||
PasswordResetToken,
|
||||
Photo,
|
||||
SiteSettings,
|
||||
User,
|
||||
UserGroup,
|
||||
)
|
||||
|
||||
db.create_all()
|
||||
|
||||
if os.getenv("SKIP_DB_INIT") != "1":
|
||||
|
||||
Reference in New Issue
Block a user