https://github.com/codeskyblue/simple_tornado
为了方便tornado使用的一个库
https://github.com/codeskyblue/simple_tornado
Last synced: 11 months ago
JSON representation
为了方便tornado使用的一个库
- Host: GitHub
- URL: https://github.com/codeskyblue/simple_tornado
- Owner: codeskyblue
- License: mit
- Created: 2020-05-13T07:01:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-07T15:26:58.000Z (about 3 years ago)
- Last Synced: 2025-03-27T03:22:34.136Z (about 1 year ago)
- Language: Python
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## simple_tornado
Make tornado use more simple
## Installation
```bash
pip3 install simple_tornado
```
## Usage
```python
import sys
import tornado.web
import simple_tornado
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello Index page")
if __name__ == "__main__":
simple_tornado.patch_for_windows()
# this patch includes
# - python 3.8 set_event_loop_policy
# - handle Ctrl-C
simple_tornado.listen_and_serve(":5000", [
(r"/", MainHandler)
])
```
Use CorsMixin
```python
class MainHandler(simple_tornado.CorsMixin, tornado.web.RequestHandler):
def get(self):
self.write("Hello Index page")
```
## LICENSE
[MIT](LICENSE)