Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
forked frompallets/quart

An async Python micro framework for building web applications.

License

NotificationsYou must be signed in to change notification settings

pgjones/quart

 
 

Repository files navigation

Quart logo

Build Statusdocspypipythonlicensechat

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 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.

Contributing

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.

Testing

The best way to test Quart is withTox,

$pip install tox$tox

this will check the code style and run the tests.

Help

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.

Relationship with Flask

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.

Migrating from Flask

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

Packages

No packages published

Languages

  • Python100.0%

[8]ページ先頭

©2009-2025 Movatter.jp