Last active
March 3, 2016 07:30
-
-
Save inlanger/728604b63a17331f90b8 to your computer and use it in GitHub Desktop.
Django models in Tornado app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tornado | |
from django.conf import settings | |
from application.events.models import Event | |
class GetDataFromCamera(tornado.web.RequestHandler): | |
def post(self): | |
json_data = json.loads(self.request.body) | |
self.finish() | |
... | |
new_event = Event(image=image, camera=camera, object=obj, add_date=tshtamp, | |
data=json.dumps(json_data, ensure_ascii=False), type=event_type, | |
value_data=value_data) | |
new_event.save() | |
application = tornado.web.Application( | |
MyRouter.apply_routes([(r"/event", GetDataFromCamera),])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment