From cc03567d2f827145b21ec9dec453cb8f9cfaeab5 Mon Sep 17 00:00:00 2001 From: ajaysi Date: Mon, 6 Apr 2026 09:03:57 +0530 Subject: [PATCH] Use Gunicorn in Procfile for Render, add platform detection --- backend/Procfile | 6 +++--- backend/start_alwrity_backend.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/Procfile b/backend/Procfile index 91cf156b..f2787b47 100644 --- a/backend/Procfile +++ b/backend/Procfile @@ -1,3 +1,3 @@ -# Use start_alwrity_backend.py for deployment -# This script handles all bootstrap logic and starts uvicorn -web: python start_alwrity_backend.py --production +# Use Gunicorn with uvicorn worker for faster port binding on Render +# Gunicorn binds immediately, then loads app in background +web: gunicorn app:app --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:$PORT --timeout 600 diff --git a/backend/start_alwrity_backend.py b/backend/start_alwrity_backend.py index 5915176f..b42dde75 100644 --- a/backend/start_alwrity_backend.py +++ b/backend/start_alwrity_backend.py @@ -9,10 +9,17 @@ import os import sys import json import argparse +import platform from pathlib import Path from dataclasses import dataclass, asdict from typing import Optional +# Detect platform +IS_WINDOWS = platform.system() == "Windows" +IS_LINUX = platform.system() == "Linux" + +import uvicorn + @dataclass class BootstrapResult: