0

I am new to python basically i work in Infra.

To test one of AWS service i have written below python code which listen "/ping" GET method and "/invocations" POST method.

from flask import Flask, Response

app = Flask(__name__)

@app.route("/ping",methods=["GET"])
def ping():
    return Response(response="ping endpoint", status=200)


@app.route("/invocations",methods=["POST"])
def predict():
    return Response(response="invocation endpoint here", status=200)

if __name__ == "__main__":
   print("Traninig started")
   app.run(host="localhost", port=8080)

This code works fine but Flask give warning like "Dont use in production".

So i was looking to do the same in Django but not able to find appropriate ways to achieve this.Not sure what i am trying to do is even doable but i hope i made it clear what i am trying to do.

davidism
  • 121,510
  • 29
  • 395
  • 339
AWS_Lernar
  • 627
  • 2
  • 9
  • 26
  • 1
    I feel you should be able to use Flask nonetheless; seems your code above is not production-ready. See https://stackoverflow.com/questions/51025893/flask-at-first-run-do-not-use-the-development-server-in-a-production-environmen – Carlo May 30 '22 at 11:31

1 Answers1

0

Use Gunicorn server for your flask projects in production