Fix Render port binding - preload_app=False, add early env debug
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
# Ensure typing constructs and models are available globally for FastAPI type annotation evaluation
|
# Ensure typing constructs and models are available globally for FastAPI type annotation evaluation
|
||||||
|
import os
|
||||||
|
|
||||||
|
# Print env vars immediately - BEFORE any imports
|
||||||
|
print(f"[app.py] EARLY - PORT={os.getenv('PORT')}, HOST={os.getenv('HOST')}", flush=True)
|
||||||
|
|
||||||
import typing
|
import typing
|
||||||
import builtins
|
import builtins
|
||||||
|
import builtins
|
||||||
|
|
||||||
# Make common typing constructs available globally
|
# Make common typing constructs available globally
|
||||||
builtins.Optional = typing.Optional
|
builtins.Optional = typing.Optional
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ accesslog = "-"
|
|||||||
errorlog = "-"
|
errorlog = "-"
|
||||||
loglevel = os.getenv("LOG_LEVEL", "info").lower()
|
loglevel = os.getenv("LOG_LEVEL", "info").lower()
|
||||||
|
|
||||||
# Preload app (set to False for faster startup if needed)
|
# Don't preload - bind to port FIRST, then load worker
|
||||||
preload_app = True
|
# This fixes "No open ports detected" on Render
|
||||||
|
preload_app = False
|
||||||
|
|
||||||
|
|
||||||
def on_starting(server):
|
def on_starting(server):
|
||||||
|
|||||||
Reference in New Issue
Block a user