Git Product home page Git Product logo

dispatcher-for-tornado's Introduction

Dispatcher for tornado

为tornado框架开发的url分发器,框架路由默认是用list,如handlers = [(r"/post_path", PostHandler), (r"/del", DeleteHandler), (r"/home",HomeHandler)]来配置路由规则,而此在访问http://localhst:8081/{controller}/{action} 的url时候,实际加载目录/appliaction/下面对应名字的控制器。即:/application/controller/{controller}Controller.py,然后执行里面的{action}方法,然后函数返回data,渲染模板。

####命名预定

  • 1,控制器为 name+Controller.py
  • 2,模板约定和控制器名字相同,在application/view下面,为{controller}/{action}.htm 如果实际中模板约定不同,在实际的控制器里面返回{'__tpl_file': 'name'}即可。

项目在tornado4.0测试通过。

####测试使用

  • 1,启动web server
python main.py
  • 2,测试
curl http://127.0.0.1:8081/test/action1
curl http://127.0.0.1:8081/test/action2

dispatcher-for-tornado's People

Contributors

iruimeng avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.