dazzling-elephant-33766
08/04/2023, 12:23 PMpex_binary(
name="app",
entry_point="gunicorn",
args=["-b", ":$PORT", "<http://services.my_service.app.app:create_app()|services.my_service.app.app:create_app()>"],
dependencies=["services/my_service"],
layout="loose",
environment="linux",
)
I think my pex binary is passing through the string '$PORT'
instead of evaluating the environment variable at runtime because I get
Error: '$PORT' is not a valid port number.
I’m deploying to google app engine and it recommends configuring gunicorn to listen on the $PORT
envvar, which is automatically set by the app engine runtime.
https://cloud.google.com/appengine/docs/standard/python3/runtime#environment_variables
Is there any way to achieve what I want without having to wrap this in a helper script?enough-analyst-54434
08/04/2023, 12:47 PM$
specially.bitter-ability-32190
08/04/2023, 1:04 PMenough-analyst-54434
08/04/2023, 1:10 PMbitter-ability-32190
08/04/2023, 1:13 PMdazzling-elephant-33766
08/04/2023, 1:33 PMdazzling-elephant-33766
08/04/2023, 1:43 PM➜ app@environment=macos.pex git:(main) ✗ PORT=8081 ./__main__.py
[2023-08-04 14:41:42 +0100] [5406] [INFO] Starting gunicorn 20.1.0
[2023-08-04 14:41:42 +0100] [5406] [INFO] Listening at: <http://0.0.0.0:8081> (5406)
So none of this is necessary. But appreciate the help regardless as I’ve learnt something 👍