Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunicorn: error: unrecognized arguments: --workers=2 server:app #1867

Closed
cyzLoveDream opened this issue Aug 29, 2018 · 8 comments
Closed

gunicorn: error: unrecognized arguments: --workers=2 server:app #1867

cyzLoveDream opened this issue Aug 29, 2018 · 8 comments

Comments

@cyzLoveDream
Copy link

image
how to solve this problem

@benoitc
Copy link
Owner

benoitc commented Aug 29, 2018

what's your command line? How do you launch gunicorn?

@teemukataja
Copy link

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.

@cyzLoveDream
Copy link
Author

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

@manish-agni
Copy link

@cyzLoveDream what did you comment out?

@drgerg
Copy link

drgerg commented Jan 5, 2020

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.

@aiwithshekhar
Copy link

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.

@lijiaoyang
Copy link

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

thx!!

@cy82359276
Copy link

if uses gunicorn command in a shell script file , the last row must be empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants