{"id":13671496,"url":"https://github.com/miguelgrinberg/aioflask","last_synced_at":"2025-04-05T19:10:11.480Z","repository":{"id":49632844,"uuid":"280222476","full_name":"miguelgrinberg/aioflask","owner":"miguelgrinberg","description":"Flask running on asyncio!","archived":false,"fork":false,"pushed_at":"2023-06-20T11:57:35.000Z","size":100,"stargazers_count":200,"open_issues_count":14,"forks_count":16,"subscribers_count":17,"default_branch":"main","last_synced_at":"2024-05-02T04:52:49.143Z","etag":null,"topics":["async-await","asyncio","flask","greenlet"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miguelgrinberg.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"miguelgrinberg","patreon":"miguelgrinberg","custom":"https://paypal.me/miguelgrinberg"}},"created_at":"2020-07-16T17:58:43.000Z","updated_at":"2024-01-10T13:34:53.000Z","dependencies_parsed_at":"2023-10-01T21:51:34.977Z","dependency_job_id":null,"html_url":"https://github.com/miguelgrinberg/aioflask","commit_stats":{"total_commits":45,"total_committers":1,"mean_commits":45.0,"dds":0.0,"last_synced_commit":"7f447e79c81ce7ca46edc5f5852845ff9806ce6a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelgrinberg%2Faioflask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelgrinberg%2Faioflask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelgrinberg%2Faioflask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelgrinberg%2Faioflask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miguelgrinberg","download_url":"https://codeload.github.com/miguelgrinberg/aioflask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289382,"owners_count":20914463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async-await","asyncio","flask","greenlet"],"created_at":"2024-08-02T09:01:11.077Z","updated_at":"2025-04-05T19:10:11.460Z","avatar_url":"https://github.com/miguelgrinberg.png","language":"Python","funding_links":["https://github.com/sponsors/miguelgrinberg","https://patreon.com/miguelgrinberg","https://paypal.me/miguelgrinberg"],"categories":["Python"],"sub_categories":[],"readme":"# aioflask\n\n![Build status](https://github.com/miguelgrinberg/aioflask/workflows/build/badge.svg) [![codecov](https://codecov.io/gh/miguelgrinberg/aioflask/branch/main/graph/badge.svg?token=CDMKF3L0ID)](https://codecov.io/gh/miguelgrinberg/aioflask)\n\nFlask 2.x running on asyncio!\n\nIs there a purpose for this, now that Flask 2.0 is out with support for async\nviews? Yes! Flask's own support for async handlers is very limited, as the\napplication still runs inside a WSGI web server, which severely limits\nscalability. With aioflask you get a true ASGI application, running in a 100%\nasync environment.\n\nWARNING: This is an experiment at this point. Not at all production ready!\n\n## Quick start\n\nTo use async view functions and other handlers, use the `aioflask` package\ninstead of `flask`.\n\nThe `aioflask.Flask` class is a subclass of `flask.Flask` that changes a few\nminor things to help the application run properly under the asyncio loop. In\nparticular, it overrides the following aspects of the application instance:\n\n- The `route`, `before_request`, `before_first_request`, `after_request`, \n  `teardown_request`, `teardown_appcontext`, `errorhandler` and `cli.command`\n  decorators accept coroutines as well as regular functions. The handlers all\n  run inside an asyncio loop, so when using regular functions, care must be\n  taken to not block.\n- The WSGI callable entry point is replaced with an ASGI equivalent.\n- The `run()` method uses uvicorn as web server.\n\nThere are also changes outside of the `Flask` class:\n\n- The `flask aiorun` command starts an ASGI application using the uvicorn web\n  server.\n- The `render_template()` and `render_template_string()` functions are\n  asynchronous and must be awaited.\n- The context managers for the Flask application and request contexts are\n  async.\n- The test client and test CLI runner use coroutines.\n\n## Example\n\n```python\nimport asyncio\nfrom aioflask import Flask, render_template\n\napp = Flask(__name__)\n\n@app.route('/')\nasync def index():\n    await asyncio.sleep(1)\n    return await render_template('index.html')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelgrinberg%2Faioflask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiguelgrinberg%2Faioflask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiguelgrinberg%2Faioflask/lists"}