- Notifications
You must be signed in to change notification settings - Fork3
An async Python micro framework for building web applications.
License
pgjones/quart
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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.
Quart can be installed viapip,
$pip install quart
and requires Python 3.7.0 or higher (seepython version supportfor reasoning).
A minimal Quart example is,
fromquartimportQuart,render_template,websocketapp=Quart(__name__)@app.route("/")asyncdefhello():returnawaitrender_template("index.html")@app.route("/api")asyncdefjson():return {"hello":"world"}@app.websocket("/ws")asyncdefws():whileTrue:awaitwebsocket.send("hello")awaitwebsocket.send_json({"hello":"world"})if__name__=="__main__":app.run()
if the above is in a file calledapp.py
it can be run as,
$python app.py
To deploy this app in a production setting see thedeploymentdocumentation.
Quart is developed onGitHub. Ifyou come across an issue, or have a feature request please open anissue. If you want tocontribute a fix or the feature-implementation please do (typo fixeswelcome), by proposing amerge request.
The best way to test Quart is withTox,
$pip install tox$tox
this will check the code style and run the tests.
The Quartdocumentation orcheatsheetare the best places to start, after that try searchingstack overflow or ask for helpon discord. If you stillcan't find an answer pleaseopen an issue.
Quart is an asyncio reimplementation of the popularFlask microframework API. This means that if youunderstand Flask you understand Quart.
Like Flask Quart has an ecosystem of extensions for more specificneeds. In addition a number of the Flask extensions work with Quart.
It should be possible to migrate to Quart from Flask by a find andreplace offlask
toquart
and then addingasync
andawait
keywords. See thedocsfor more help.
About
An async Python micro framework for building web applications.
Resources
License
Code of conduct
Stars
Watchers
Forks
Packages0
Languages
- Python100.0%