I am using the Tornado chat demo example from here: https://github.com/tornadoweb/tornado/tree/master/demos/chat and just altering it very slightly. The code change is just a small class called Connections and a bit in the MessageNewHandler(). All I am doing is just saving a reference to self and trying to wr…
Tag: tornado
Tornado: how to close file object if exception/error in data_received when streaming chunked data to file
I am running Tornado with stream_request_body and saving a file POST request to file on server. In prepare I create the file object and in post I close file object. How do I capture any error/exception in data_received so that I can close the file object properly? terminal output where tornado app is running …
How do I pass variables to scss processor?
My current set up is Front-end: VueJS Backend Python, Tornado Vue is used using the cdn for indivudual static templates. Tornado serves the templates. I’m using the python scss library to compile the scss, that part of pretty straight forward. I have two config.py files that hold configurations with two…
How to get form POST input in Tornado?
I amd new to Tornado framework and trying to make a simple form to upload images: I can successfully receive the Posted file using: However I’m unable to receive the alt input. I tried alt = self.request.alt but I get this error and when I use alt = self.request.files[‘alt’], I get: I ran ou…
Calling a Tornado handler in another handler
I want to split a Tornado handler in two handlers. In the first handler, I want send a command to a sensor. In the second handler, I want to wait for a response from the sensor. Is this possible? Or I can’t call an handler from another? If it’s possible, how I can call this second handler? Thank y…
Python-Tornado on Heroku
I am trying to deploy Tornado on Heroku. I am able to run a simple “hello world” app on using this method: http://kzk9.net/deploying-tornado-on-heroku-mac-os-x But while trying Tornado demo-app “chatdemo”, the server is crashing with following logs: Anybody has any idea whats wrong? An…
How do I get the client IP of a Tornado request?
I have a RequestHandler object for incoming post()s. How can I find the IP of the client making the request? I’ve browsed most of RequestHandler’s methods and properties and seem to have missed something. Answer RequestHandler.request.remote_ip (from RequestHandler’s instance) you can inspec…