Skip to content

A framework to simplify tornado daemon development and project orgnization.

License

Notifications You must be signed in to change notification settings

cfhamlet/os-tornado

Repository files navigation

os-tornado

image

image

PyPI - Python Version

PyPI

A framework to organize tornado project and simplify development.

Note

This project will no longer maintenance. You can use os-sanic as substitute which has better performance and more flexible.

Install

pip install os-tornado

Usage

  • Create project

    os-tornado startproject new_project

    Will create a project structure:

    new_project/
    ├── app
    │   ├── extensions
    │   │   ├── example_extension.py
    │   │   ├── __init__.py
    │   ├── request_handlers
    │   │   ├── example_handler.py
    │   │   ├── __init__.py
    │   ├── __init__.py
    │   ├── settings.py
    └── manager.py
  • Write your extensions and request handlers
  • Configure settings (app/settings.py)
  • Run server

    python manager.py runserver

Advanced Usage

  • os_tornado.decorators.jsonify

    jsonify returned dict and raised HTTPError

    example:

    @jsonify
    class ExampleHandler(RequestHandler):
    
        def get(self, *args, **kwargs):
            return {'status':'ok'}
    
        def post(self, *args, **kwargs):
            raise HTTPHandler(405)

Unit Tests

$ tox

License

MIT licensed.

About

A framework to simplify tornado daemon development and project orgnization.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published