{"id":25733766,"url":"https://github.com/ryosukedtomita/flask_playground","last_synced_at":"2026-06-13T12:02:47.618Z","repository":{"id":279085125,"uuid":"937240505","full_name":"RyosukeDTomita/flask_playground","owner":"RyosukeDTomita","description":"Flaskの機能を試しただけ","archived":false,"fork":false,"pushed_at":"2025-02-23T16:48:19.000Z","size":6,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T17:34:25.224Z","etag":null,"topics":["flask-api","flask-cli","flask-db","hello-world","python3","rye"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyosukeDTomita.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-22T17:05:58.000Z","updated_at":"2025-02-23T16:52:44.000Z","dependencies_parsed_at":"2025-02-23T17:44:34.211Z","dependency_job_id":null,"html_url":"https://github.com/RyosukeDTomita/flask_playground","commit_stats":null,"previous_names":["ryosukedtomita/flask_playground"],"tags_count":0,"template":false,"template_full_name":"RyosukeDTomita/template_repository_python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Fflask_playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Fflask_playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Fflask_playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Fflask_playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyosukeDTomita","download_url":"https://codeload.github.com/RyosukeDTomita/flask_playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240790292,"owners_count":19858010,"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":["flask-api","flask-cli","flask-db","hello-world","python3","rye"],"created_at":"2025-02-26T04:22:40.383Z","updated_at":"2026-06-13T12:02:47.577Z","avatar_url":"https://github.com/RyosukeDTomita.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask playground\n\n![un license](https://img.shields.io/github/license/RyosukeDTomita/flask_playground)\n\n## INDEX\n\n- [ABOUT](#about)\n- [ENVIRONMENT](#environment)\n- [PREPARING](#preparing)\n- [HOW TO USE](#how-to-use)\n\n---\n\n## ABOUT\n\nTry to use Flask's features.\nFlaskの機能を試すためのリポジトリ\n\n- [Flask REST API](#flask-rest-api)\n- [Flask CLI](#flask-cli)\n- [Flask Migrate](#flask-migrate)\n\n---\n\n## ENVIRONMENT\n\n- Python: 3.12.4\n  - Flask\n  - rye\n\nsee [Dockerfile](./Dockerfile) and [pyproject.toml](./pyproject.toml) in detail.\n\n---\n\n## PREPARING\n\n### Using Dev Container\n\nopen VSCode and use `Dev Containers: Rebuild Container without cache`\n\n### Not Using Dev Container\n\n```bash\ncd flask_playground\ndocker compose up\n```\n\n---\n\n## HOW TO USE\n\n### Flask REST API\n\nIn [Dockerfile](./Dockerfile), `gunicorn` activates flask app.\n\n```bash\n/flask/.venv/bin/gunicorn app:run --chdir /flask/src\n```\n\nGo to [http://localhost:8000](http://localhost:8000) and you can see the Hello World message.\n\n### Flask CLI\n\n```shell\ncd /flask/src\n/flask/.venv/bin/flask hello say --name sigma\n```\n\n### Flask Migrate\n\n#### `mydatabase` only\n\n\u003e [!WARNING]\n\u003e This repository uses multiple databases.\n\nbefore `flask db upgrade`, you can see only `alembic_version` table.\n\n```shell\ncd /flask/src\n/flask/.venv/bin/flask db init\n/flask/.venv/bin/flask db migrate\n```\n\n```sql\nmysql -h mysql_svr -u root -p\nmysql\u003e USE mydatabase;\nDatabase changed\nmysql\u003e SHOW TABLES;\n+----------------------+\n| Tables_in_mydatabase |\n+----------------------+\n| alembic_version      |\n+----------------------+\n1 row in set (0.00 sec)\n```\n\n```shell\n/flask/.venv/bin/flask db upgrade\n```\n\n```sql\nmysql\u003e SHOW TABLES;\n+----------------------+\n| Tables_in_mydatabase |\n+----------------------+\n| alembic_version      |\n| users                |\n+----------------------+\n2 rows in set (0.00 sec)\n```\n\n#### multiple databases\n\n[Multiple Database with bind](https://flask-sqlalchemy.readthedocs.io/en/stable/binds/)\n\n```sql\nmysql -h mysql_svr -u root -p\nUSE mydatabase;\nDROP TABLE alembic_version;\ndrop table users;\nCREATE DATABASE mydatabase_alt; -- flask db cannot create database\n```\n\n```shell\nrm -rf migrations # if any\n/flask/.venv/bin/flask db init --multidb\n```\n\n---\n\n## memo\n\n### rye\n\n- `rye install`ではpyproject.tomlのdependenciesにライブラリが追加されない。これがしたいなら，`rye add`を使う。\n- `rye run python run.py`のようにすると，venv内のpythonを使って.pyを実行できる。\n- `rys sync`するとpyproject.tomlのdependenciesに記述されたライブラリがvenvにインストールされる。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryosukedtomita%2Fflask_playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryosukedtomita%2Fflask_playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryosukedtomita%2Fflask_playground/lists"}