how to solve this problem
what's your command line? How do you launch gunicorn?
Make sure that you are in the same directory as server.py
and that your function is named def app()
. If you are in a directory above server.py
you can add the directory name into the module with a dot .
for example if the python script resides in dir/server.py
you can say gunicorn --workers=2 dir.server:app
.
well, I have resolved this problem. it ended up that I had ArgumentParser attempting to get arguments from CLI - I commented that out and it works. @benoitc @teemukataja
@cyzLoveDream what did you comment out?
I've been beating my head on a similar problem. Read this thread and recognized a possibility.
I was using the argparse module. I removed it from my .py file and gunicorn started working.
Really helpful!! gunicorn service file, nginx setting everything was perfect but still i was not getting error 'ERR_EMPTY_RESPONSE'.
Then i changed the proxy buffer, timout nothing worked but as i removed the argparser it worked smoothly.
Most helpful comment
well, I have resolved this problem. it ended up that I had ArgumentParser attempting to get arguments from CLI - I commented that out and it works. @benoitc @teemukataja