{"id":18176649,"url":"https://github.com/systemlight/madtornado4","last_synced_at":"2025-04-07T10:38:15.894Z","repository":{"id":57439091,"uuid":"291403679","full_name":"SystemLight/madtornado4","owner":"SystemLight","description":":ocean:  Madtornado is a tool for generating Tornado projects for MVC.【生成tornado MVC项目模板 CLI脚手架(scaffolding)】","archived":false,"fork":false,"pushed_at":"2022-03-12T12:47:00.000Z","size":255,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-15T08:42:44.022Z","etag":null,"topics":["cli","generator","madtornado","mvc","python35","scaffolding","template","tornado","tornado-framework"],"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/SystemLight.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":null,"security":null,"support":null}},"created_at":"2020-08-30T05:04:18.000Z","updated_at":"2024-07-12T08:58:18.000Z","dependencies_parsed_at":"2022-09-19T14:10:38.470Z","dependency_job_id":null,"html_url":"https://github.com/SystemLight/madtornado4","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmadtornado4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmadtornado4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmadtornado4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SystemLight%2Fmadtornado4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SystemLight","download_url":"https://codeload.github.com/SystemLight/madtornado4/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640096,"owners_count":20971549,"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":["cli","generator","madtornado","mvc","python35","scaffolding","template","tornado","tornado-framework"],"created_at":"2024-11-02T17:09:51.947Z","updated_at":"2025-04-07T10:38:15.877Z","avatar_url":"https://github.com/SystemLight.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Madtornado4\n\nMadtornado4是一个构建MVC Tornado项目的工具。\n\n[![Documentation Status](https://readthedocs.org/projects/madtornado4/badge/?version=latest)](https://madtornado4.readthedocs.io/?badge=latest)\n[![Build Status](https://www.travis-ci.org/SystemLight/madtornado4.svg?branch=master)](https://www.travis-ci.org/SystemLight/madtornado4)\n\n## 安装\n\n```\npip install madtornado4\nmad install \u003cversion\u003e\n```\n\n## 用法\n\nmadtornado4通过`mad`命令提供构建操作，在控制台中键入mad即可获得帮助\n\n- mad install [version]: 指定madtornado的版本号在当前目录下初始化项目。\n- mad list: 查看所有可用的madtornado版本。\n- mad new [Template]: 在madtornado4项目下新建制定模板文件，如果不输入模板名称列出所有模板。\n\n## 数据库连接\n\n1. 环境中需要安装aiomysql\n2. 配置launch.json\n3. 打开galaxy中的__init__.py，注册mysql服务`stp.add_scoped(mysql.MysqlService).add_singleton(mysql.MysqlPoolService)`\n4. 基本使用举例\n\n```python\nclass DatabaseInsertDemo(ApiGhost):\n    __urls = api_router([\"/database/insert\"])\n\n    @api_method\n    async def get(self):\n        \"\"\"\n\n        插入一条数据到表格\n        访问地址：/api/database/insert\n\n        \"\"\"\n        service: mysql.MysqlService = await self.obtain(\"MysqlService\")(self.obtain(\"MysqlPoolService\"))\n        await service.execute(\"insert into user (name, age) values ('Lisys',20)\")\n        return \"插入一条数据\"\n\n\nclass DatabaseSelectDemo(ApiGhost):\n    __urls = api_router([\"/database/select\"])\n\n    @api_method\n    async def get(self):\n        \"\"\"\n\n        插入一条数据到表格\n        访问地址：/api/database/select\n\n        \"\"\"\n        service: mysql.MysqlService = await self.obtain(\"MysqlService\")(self.obtain(\"MysqlPoolService\"))\n        data = await service.queryall(\"select * from user\")\n        return data\n```\n\n## 异步解决方案\n\n| 领域 | 模块 |\n| --- | --- |\n| web | [tornado](https://github.com/tornadoweb/tornado) |\n| mysql | [aiomysql](https://github.com/aio-libs/aiomysql) |\n| sqlite3 | [aiosqlite](https://github.com/omnilib/aiosqlite) |\n| ORM | [peewee-async](https://github.com/05bit/peewee-async) |\n| GraphQL | [graphene-tornado](https://github.com/graphql-python/graphene-tornado) |\n| file | [aiofiles](https://github.com/Tinche/aiofiles) |\n| cpu | [celery](https://github.com/celery/celery) |\n\n## 文档\n\n- 你可以阅读 [madtornado4 Documentation](https://madtornado4.readthedocs.io/?badge=latest) 在线文档获取更多使用方法。\n- 你也可以阅读 [tornado Documentation](https://www.osgeo.cn/tornado/index.html) 来了解tornado基础使用\n- 自制正则路由辅助工具[regulex](https://jex.im/regulex)\n\n## License\n\nMadtornado4 uses the MIT license, see LICENSE file for the details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemlight%2Fmadtornado4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsystemlight%2Fmadtornado4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemlight%2Fmadtornado4/lists"}