How does gunicorn execute a module with parameters?

for example, I have a command to call up the web service: python run.py-c web

run.py is a unified entry file. Dynamically adjust another sub-module through the -c web parameter (the sub-module cannot be run alone).

how do I call run.py via gunicorn and pass in the command line parameter -c web ?

Aug.05,2021

gunicorn can't be used in this way. First of all, you have to make sure that using gunicorn makes the program run without parameters, that is to say, the web service you write is a normal wsgi program, so we can discuss how to dynamically call another submodule instead of following your solution.


whether commands that can be run are written to a shell script, for example: run.sh

-sharp!/bin/bash 
python run.py -c web

attach executable permissions to run.sh,

sudo chmod a+x run.sh

then gunicorn calls run.sh?


@ everfigt A good way to try it is to estimate that there may be problems when supervisor stops service in this way

< hr >

I am also obsessed with the morning. Indeed, as I said downstairs, gunicorn must call the python module

< hr > In the end, I still obediently write the ptyhon file module, and there is no good solution.

Menu