2 ms·
Well, most (or all) web applications I've worked with make database calls to serve a response, which (in case of Flask) locks the whole thread I don't get this
by icebraining 11y ago
Well, most (or all) web applications I've worked with make database calls to serve a response, which (in case of Flask) locks the whole thread
I don't get this, when did Flask start connecting to databases? The only point of Flask is that it only provides an HTTP layer, nothing more. If you want to connect to a database, you have to import some other library (or use something from Python's standard library), which may or may not be blocking.
- orf 11y agoFlask started talking to databases the moment people started using it. It's a web framework. OP's comment was saying it's single threaded nature is a detriment.
- icebraining 11y agoFlask is just an HTTP layer, not an execution engine, so it doesn't really have a single- or multi-threaded nature. It's thread-safe, though. That said, the default development server built-in (which uses werkzeug's underneath) is multi-threaded - just pass threaded=True to app.run(...) - and in production, you can deploy a Flask app using an evented framework like Tornado or Gevent: http://flask.pocoo.org/docs/0.10/deploying/wsgi-standalone/#tornado http://flask.pocoo.org/docs/0.10/deploying/wsgi-standalone/#...