Cross-post from https://github.com/pantsbuild/pex/issues/1181 as I didn't really know where to ask this.
I'm using Nginx Unit, which has an ASGI configuration for my FastAPI application. It's working fine, but I have no clue how to use it with a PEX.
I've attached it below, but the salient point is that there is a Python plugin for Nginx Unit which is looking for a "module" and a "callable".
What this looks like now is "apigateway.main:app" similar to uvicorn or whatever other server implementation you're using. Unlike uvicorn, gunicorn, or whatever - I don't think I can package any other tool in my pex file and use PEX_SCRIPT.
Is there any suggestion on if/how I can expose a module and variable outside of the pex?
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"action": {
"pass": "applications/api"
}
}
],
"applications": {
"api": {
"type": "python 3.9",
"path": "/app",
"module": "apigateway.main",
"callable": "app",
"limits": {
"requests": 100
},
"processes": {}
}
},
"access_log": "/var/log/access.log"
}