Reputation: 3962
I'm trying to start the swagger server using gunicorn on ec2 instance by using the following code:
I tried :
gunicorn -w 4 -b 0.0.0.0:8080 -p pidfile -D swagger_server:app
and this:
gunicorn -w 4 -b 0.0.0.0:8080 -p pidfile -D "python3 -m swagger_server":app
and even this :
gunicorn -w 4 -b 0.0.0.0:8080 -p pidfile -D __main__:app
How can I get it to work?
RAW python code which works : python3 -m swagger_server
Upvotes: 1
Views: 2868
Reputation: 2680
This one worked for me:
gunicorn "swagger_server.__main__:app" -w 4 -b 0.0.0.0:8080
Upvotes: 0
Reputation: 46
What you are trying to do is equivalent to:
from swagger_server.__main__ import main
For this to work with gunicorn, try:
gunicorn "swagger_server.__main__:main" -w 4 -b 0.0.0.0:8080`
In case you have the error:
ImportError: No module named swagger_server
add the PYTHONPATH to gunicorn command:
gunicorn "swagger_server.__main__:main" -w 4 -b 0.0.0.0:8080 --pythonpath path_to_swagger_server
Upvotes: 3
Reputation: 1
isn't your application looking for a configuration file with a section like [app:main]?
Upvotes: 0
Reputation: 1
gunicorn -b 0.0.0.0:8080 main:app --reload
This should be the correct syntax, obviously make sure you're in the correct directory and source your virtualenv.
Upvotes: 0