Skip to main content

A Python ASGI web microframework with the same API as Flask

Project description

Quart logo

Build Status docs pypi python license chat

Quart is an async Python web microframework. 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

Quart can be installed via pip,

$ pip install quart

and requires Python 3.7.0 or higher (see python version support for reasoning).

A minimal Quart example is,

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"})

if __name__ == "__main__":
    app.run()

if the above is in a file called app.py it can be run as,

$ python app.py

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

Contributing

Quart is developed on GitHub. If you come across an issue, or have a feature request please open an issue. If you want to contribute a fix or the feature-implementation please do (typo fixes welcome), by proposing a merge request.

Testing

The best way to test Quart is with Tox,

$ pip install tox
$ tox

this will check the code style and run the tests.

Help

The Quart documentation or cheatsheet are the best places to start, after that try searching stack overflow or ask for help on discord. If you still can’t find an answer please open an issue.

Relationship with Flask

Quart is an asyncio reimplementation of the popular Flask microframework API. 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 docs 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.18.4.tar.gz (85.0 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.18.4-py3-none-any.whl (100.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quart-0.18.4.tar.gz
  • Upload date:
  • Size: 85.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.2 Linux/5.4.0-1085-aws

File hashes

Hashes for quart-0.18.4.tar.gz
Algorithm Hash digest
SHA256 c1766f269cdb85daf9da67ba54170abf7839aca97304dcb4cd0778eabfb442c6
MD5 42e1aa9c9441aa019889b1dc85f15596
BLAKE2b-256 c593be1bd58558bd2f026b75a147c814f5117617dbb9f1e1144849ed2852d6c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quart-0.18.4-py3-none-any.whl
  • Upload date:
  • Size: 100.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.8.2 Linux/5.4.0-1085-aws

File hashes

Hashes for quart-0.18.4-py3-none-any.whl
Algorithm Hash digest
SHA256 578a466bcd8c58b947b384ca3517c2a2f3bfeec8f58f4ff5038d4506ffee6be7
MD5 4a7073f874d44c2f3865d08dc64cb851
BLAKE2b-256 8f79ccd45c2374711b632647aad3dc27af4341c96a852049603493e33c288762

See more details on using hashes here.

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