how are you meant to turn something that runs from...
# general
a
how are you meant to turn something that runs from another script (e.g.
gunicorn
) into a
.pex
? setting
script="gunicorn"
works... but doesn't allow specifying the
myproject.wsgi
argument.
f
Maybe have a stub script for each service that calls into common setup code that invokes gunicorn? (That is what we do at my company for our Django servers.)
👍 1
f
You can also just use the entry point exported by gunicorn. This works for things like gunicorn that use an defined entry point to create scripts (https://github.com/benoitc/gunicorn/blob/master/setup.py#L116). I doubt this would work for django or something that doesn't use that mechanism. so you'd have something like...
Copy code
pex_binary(
    name="app",
    dependencies=[":lib" ,"//:gunicorn"],
    entry_point="gunicorn.app.wsgiapp:run",
    ...
)
And then you could run this like
./app.pex $GUNICORN_OPTIONS <http://your.gunicorn.app:entry_point|your.gunicorn.app:entry_point>
a
@flat-zoo-31952 Yeah, this is where I'm at. But I feel like that's "broken". as it only ever works if you provide
<http://your.gunicorn.app:entry_point|your.gunicorn.app:entry_point>
as the command line argument.
@fast-nail-55400 a stub shell script? Is there a way to make the
.pex
run this?
f
No, a stub Python script.
h
To clarify, are you wanting to bake arguments into the pex?
a
yes. I think
./django-app.pex
should require 0 additional augments to run, even if it's a basic runtime configuration.
e
a
ah yes. that's the one.
in the meantime, I've found a workaround along the same line as @fast-nail-55400's suggestion