0
votes

I use gunicorn and gevent to start my flask app on my local with this command -

gunicorn api:app -k gevent --worker-connections 1000

It says -

[2020-09-24 11:06:32 +0000] [6] [INFO] Starting gunicorn 20.0.4
[2020-09-24 11:06:32 +0000] [6] [INFO] Listening at: http://127.0.0.1:8000 (6)
[2020-09-24 11:06:32 +0000] [6] [INFO] Using worker: gevent
[2020-09-24 11:06:32 +0000] [8] [INFO] Booting worker with pid: 8

But when I try to fire an API at this URL or open this URL, it doesn't get any response.

  1. Is my command correct ?
  2. If its not correct, whats the correct command to start the flask app using gevent and gunicorn ?
1
Do you have any routes setup?Daniel Scott
i don't have route setup. What is that ? How to do that ?Gissipi_453
A method annotated with @app.route() - I've added an answerDaniel Scott

1 Answers

1
votes

You need to setup a route in your code:

https://flask.palletsprojects.com/en/1.1.x/quickstart/

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
  return 'Hello, World!'