Skip to main content

A Python ASGI web framework with the same API as Flask

Project description

Quart

Quart is an async Python web application framework. Using Quart you can,

  • render and serve HTML templates,
  • write (RESTful) JSON APIs,
  • serve WebSockets,
  • stream request and response data,
  • do pretty much anything over the HTTP or WebSocket protocols.

Quickstart

Install from PyPI using an installer such as pip.

$ pip install quart

Save the following as app.py. This shows off rendering a template, returning JSON data, and using a WebSocket.

from quart import Quart, render_template, websocket

app = Quart(__name__)

@app.route("/")
async def hello():
    return await render_template("index.html")

@app.route("/api")
async def json():
    return {"hello": "world"}

@app.websocket("/ws")
async def ws():
    while True:
        await websocket.send("hello")
        await websocket.send_json({"hello": "world"})
$ quart run
 * Running on http://127.0.0.1:5000 (CTRL + C to quit)

To deploy this app in a production setting see the deployment documentation.

Contributing

Quart is developed on GitHub. If you come across a bug, or have a feature request, please open an issue. To contribute a fix or implement a feature, follow our contributing guide.

Help

If you need help with your code, the Quart documentation and cheatsheet are the best places to start. You can ask for help on the Discussions tab or on our Discord chat.

Relationship with Flask

Quart is an asyncio reimplementation of the popular Flask web application framework. This means that if you understand Flask you understand Quart.

Like Flask, Quart has an ecosystem of extensions for more specific needs. In addition, a number of the Flask extensions work with Quart.

Migrating from Flask

It should be possible to migrate to Quart from Flask by a find and replace of flask to quart and then adding async and await keywords. See the migration documentation for more help.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quart-0.21.0.tar.gz (65.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quart-0.21.0-py3-none-any.whl (78.9 kB view details)

Uploaded Python 3

File details

Details for the file quart-0.21.0.tar.gz.

File metadata

  • Download URL: quart-0.21.0.tar.gz
  • Upload date:
  • Size: 65.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quart-0.21.0.tar.gz
Algorithm Hash digest
SHA256 ec05a784151386cf87df51f764825d55f3ac402df4f04fd1dc81faca8897ceda
MD5 a3801eb350d7b6f0b31421cfd6d4cd14
BLAKE2b-256 29a7d3e1a5f2afac1b20ca65e740bd2686b45b2c8c9de418d851feddeafadaa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for quart-0.21.0.tar.gz:

Publisher: publish.yaml on pallets/quart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quart-0.21.0-py3-none-any.whl.

File metadata

  • Download URL: quart-0.21.0-py3-none-any.whl
  • Upload date:
  • Size: 78.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for quart-0.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a21377754d52ee3a9de7f9bff140dc3bb055e2eec8ac187da1789b36cf4c66ca
MD5 df7b3762f6b240dd4bc08e5dec23173d
BLAKE2b-256 44a105114d779ddad67d45b03faf2de941a74146b37ee1d626a9d193ac4c2153

See more details on using hashes here.

Provenance

The following attestation bundles were made for quart-0.21.0-py3-none-any.whl:

Publisher: publish.yaml on pallets/quart

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page