Giter VIP home page Giter VIP logo

madtornado4's Introduction

Madtornado4

Madtornado4是一个构建MVC Tornado项目的工具。

Documentation Status Build Status

安装

pip install madtornado4
mad install <version>

用法

madtornado4通过mad命令提供构建操作,在控制台中键入mad即可获得帮助

  • mad install [version]: 指定madtornado的版本号在当前目录下初始化项目。
  • mad list: 查看所有可用的madtornado版本。
  • mad new [Template]: 在madtornado4项目下新建制定模板文件,如果不输入模板名称列出所有模板。

数据库连接

  1. 环境中需要安装aiomysql
  2. 配置launch.json
  3. 打开galaxy中的__init__.py,注册mysql服务stp.add_scoped(mysql.MysqlService).add_singleton(mysql.MysqlPoolService)
  4. 基本使用举例
class DatabaseInsertDemo(ApiGhost):
    __urls = api_router(["/database/insert"])

    @api_method
    async def get(self):
        """

        插入一条数据到表格
        访问地址:/api/database/insert

        """
        service: mysql.MysqlService = await self.obtain("MysqlService")(self.obtain("MysqlPoolService"))
        await service.execute("insert into user (name, age) values ('Lisys',20)")
        return "插入一条数据"


class DatabaseSelectDemo(ApiGhost):
    __urls = api_router(["/database/select"])

    @api_method
    async def get(self):
        """

        插入一条数据到表格
        访问地址:/api/database/select

        """
        service: mysql.MysqlService = await self.obtain("MysqlService")(self.obtain("MysqlPoolService"))
        data = await service.queryall("select * from user")
        return data

异步解决方案

领域 模块
web tornado
mysql aiomysql
sqlite3 aiosqlite
ORM peewee-async
GraphQL graphene-tornado
file aiofiles
cpu celery

文档

License

Madtornado4 uses the MIT license, see LICENSE file for the details.

madtornado4's People

Contributors

systemlight avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.