2

I wanted to create a variable which will keep the request object per restful service call during entire slice. I am not sure what is the best way to handle it in Flask. I am using Flask + Mongoengine. The reason for this is because I want to pass the same information to every CRUD operations to record the request.

Will

g

is right option or something else?

Mukesh
  • 115
  • 1
  • 2
  • 9

1 Answers1

8

You will need to set app.run(threaded=True)) in order to make your Flask application capable of handling multiple concurrent requests.

You may also like to go through the URL - http://flask.pocoo.org/docs/1.0/tutorial/deploy/.

maugch
  • 1,276
  • 3
  • 22
  • 46
Pralhad Narsinh Sonar
  • 1,406
  • 1
  • 14
  • 23
  • 1
    Thanks for answer. what about g instance, will it be shared across threads or have different instance of g? – Mukesh Jun 21 '15 at 21:27