Skip to content

Instantly share code, notes, and snippets.

View chihane's full-sized avatar

chihane chihane

  • Insomnia Inc.
  • Wuhan, China
View GitHub Profile
@JeOam
JeOam / Structure.md
Last active April 18, 2023 06:52
Project Structure for Python (Tornado) Application

Project:

  • project/: A directory named with the project's name which stores the actual Python package
    • __init__py
    • app.py
    • settings.py
    • urls.py
    • models/
      • __init__.py
      • baes.py
  • handlers/
@mminer
mminer / jsonhandler.py
Created April 26, 2013 02:36
A JSON request handler for Tornado.
import json
import tornado.web
class JsonHandler(BaseHandler):
"""Request handler where requests and responses speak JSON."""
def prepare(self):
# Incorporate request JSON into arguments dictionary.
if self.request.body:
try: