{"id":16554759,"url":"https://github.com/j178/flask-scaffold","last_synced_at":"2026-06-29T21:31:36.750Z","repository":{"id":108936673,"uuid":"298054397","full_name":"j178/flask-scaffold","owner":"j178","description":"Modular flask scaffold","archived":false,"fork":false,"pushed_at":"2020-09-28T09:53:33.000Z","size":188,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-02T07:48:48.783Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j178.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-23T18:06:02.000Z","updated_at":"2021-09-26T07:01:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"6577a706-895f-4b70-a6e7-6bcfc6d4354d","html_url":"https://github.com/j178/flask-scaffold","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/j178/flask-scaffold","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j178%2Fflask-scaffold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j178%2Fflask-scaffold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j178%2Fflask-scaffold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j178%2Fflask-scaffold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j178","download_url":"https://codeload.github.com/j178/flask-scaffold/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j178%2Fflask-scaffold/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34944147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-11T19:52:16.874Z","updated_at":"2026-06-29T21:31:36.728Z","avatar_url":"https://github.com/j178.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flask-scaffold\n\n## Features\n\n## How to use\n\n```shell script\n$ git clone git@github.com:j178/flask-scaffold.git\n$ cd flask-scaffold\n$ pipenv install\n$ pipenv shell\n```\n\nUnder development:\n\n```shell\n$ export FLASK_ENV=development\n$ flask db migrate -m \"xxxx\"\n```\n\nor\n\n```shell\n$ FLASK_ENV=development flask db migrate -m \"xxxx\"\n```\n\n## Common commands\n\ncommand | function\n---- | ---\nflask run | 启动开发服务器\nflask shell | 启动调试 Shell\nflask db migrate  -m *message* | 生成数据库修改记录\nflask db upgrade | 升级数据库\nflask routes | 查看路由记录\nflask test | 执行测试用例\npipenv shell | Spawn a venv shell\npipenv install *package* | 安装新的依赖\ndocker-compose up -d | 启动所有服务\ndocker-compose run -d -p 3306:3306 db | 启动开发用数据库\n\n\n\n## Parameter validation\n`request.data_dict` contains the data has been parsed and validated.\n\nDefine a new parameter schema:\n```python\nfrom flask import request\nfrom marshmallow import Schema, fields\nfrom app import make_api\n\nclass UpdateMessageSchema(Schema):\n    id = fields.Integer(required=True)\n    message = fields.String(required=True)\n\n@app.route('/message', methods=['POST'])\n@make_api.make_api(make_api.json, schema=UpdateMessageSchema())\ndef update_message():\n    data = request.data_dict\n    ...\n```\n\n## Auth\n\n## Protobuf support\n \n## Error handling\n\n在视图函数中，如果想提前结束流程，可以抛出 `APIError`，比如:\n```python\nfrom flask import request\nfrom app.errors import APIError, errno\n\nif request.data_dict.get('id'):\n    raise APIError(errno.INVALID_PARAMETERS)\n```\n\n## Logging\n\n## DB model\n\n## Pagnination\n\n### Query\n\n### Save \u0026 Update\n\n### Delete\n\n## Add new flask subcommand\n\n## Docker\n\nBuild images with:\n```shell script\n$ docker build --tag \u003cname\u003e --file docker/Dockerfile . \n```\n\nYou can stop the build at specific stages with the --target option:\n```shell script\n$ docker build --tag \u003cname\u003e --file docker/Dockerfile . --target \u003cstage\u003e\n```\nFor example we wanted to stop at the development stage:\n```shell script\n$ docker build --tag poetry-project --file docker/Dockerfile --target development .\n```\n\n# Todo\n- [x] 完善 Dockerfile 和 docker-compose\n- [x] 增加 marshmallow 相关内容\n- [ ] 增加 hmac 签名\n- [x] 增加 protobuf 支持\n- [ ] 完善基于 pytest 的测试框架\n- [ ] 增加 trace\n- [ ] 增加 metric\n- [ ] 增加日志配置","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj178%2Fflask-scaffold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj178%2Fflask-scaffold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj178%2Fflask-scaffold/lists"}