E
E
eegmak2022-04-12 10:12:23
Flask
eegmak, 2022-04-12 10:12:23

How does flask code handle requests?

I compiled an example for the heroku server on flask, python, which, when you click on the link in the browser, shows the line 'hello world'.

from flask import Flask
Flask(__name__)
@app.route('/')
def hello_world():
    return 'Hello, World!'

If this link is opened by many users at the same time, will the script work? Will all users start downloading the script at the same time, or will there be a queue?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2022-04-12
@eegmak

flask is a synchronous framework, so all requests are processed in turn, there can be several queues

J
Jack444, 2022-04-12
@Jack444

do it and you will be happy

from aiohttp import web

async def hello_world():
    return web.Response(text='Hello, World!')

app = web.Application()
app.router.add_get('/', hello_world)

web.run_app(app)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question