tornado

How to set React to production mode when using Gulp

How to set React to production mode when using Gulp Question: I need to run React in production mode, which presumably entails defining the following somewhere in the enviornment: process.env.NODE_ENV = ‘production’; The issue is that I’m running this behind Tornado (a python web-server), not Node.js. I also use Supervisord to manage the tornado instances, …

Total answers: 5

python – When are WebSocketHandler and TornadoWebSocketClient completely deleted?

python – When are WebSocketHandler and TornadoWebSocketClient completely deleted? Question: I’m working on an application that must support client-server connections. In order to do that, I’m using the module of tornado that allows me to create WebSockets. I intend to be always in operation, at least the server-side. So I am very worried about the …

Total answers: 2

tornado 403 GET warning when opening websocket

tornado 403 GET warning when opening websocket Question: I found this python script which should allow me to open a WebSocket. However, I receive the warning [W 1402720 14:44:35 web:1811] 403 GET / (192.168.0.102) 11.02 ms in my Linux terminal when trying to open the actual WebSocket (using Old WebSocket Terminal Chrome plugin). The messages …

Total answers: 3

Can not established Websocket secure connection on Firefox

Can not established Websocket secure connection on Firefox Question: I am stuck with Firefox. I could not make WebSocket work on it. I use Tornado Websocket and I initialized it by code below: app = Application([(r’/mypath/ws’, WSHandler)]) http_server = HTTPServer(app, ssl_options={ "certfile": "~/certs/websocket.crt", "keyfile": "~/certs/websocket.key" }) http_server.listen("443") And I initialized it on Javascript side like …

Total answers: 7

transferring big files to a limited memory server

transferring big files to a limited memory server Question: I want to have my webservice accept large file transfers from customers. To do this, I am planning to use nginx over tornado to take care of limited memory at the server side during file upload. Is this a good plan? Or should I use some …

Total answers: 2

Running an async background task in Tornado

Running an async background task in Tornado Question: Reading the Tornado documentation, it’s very clear how to call an async function to return a response: class GenAsyncHandler(RequestHandler): @gen.coroutine def get(self): http_client = AsyncHTTPClient() response = yield http_client.fetch(“http://example.com”) do_something_with_response(response) self.render(“template.html”) What’s lacking is how should a call be made asynchronously to a background task that has …

Total answers: 5

tornado vs wsgi(with gunicorn)

tornado vs wsgi(with gunicorn) Question: I read this about Tornado: On the other hand, if you already have a WSGI app and want to run it on a blazing fast tornado.httpserver.HTTPServer, wraps it with tornado.wsgi.WSGIContainer. But you need to be careful. Since your original application is not prepared for an asynchronous server, and will make …

Total answers: 1

How to create HTTPS tornado server

How to create HTTPS tornado server Question: Please help me to create HTTPS tornado server My current code Python3 doesn’t work import os, socket, ssl, pprint, tornado.ioloop, tornado.web, tornado.httpserver from tornado.tcpserver import TCPServer class getToken(tornado.web.RequestHandler): def get(self): self.write(“hello”) application = tornado.web.Application([ (r’/’, getToken), ]) # implementation for SSL http_server = tornado.httpserver.HTTPServer(application) TCPServer(ssl_options={ “certfile”: os.path.join(“/var/pyTest/keys/”, “ca.csr”), …

Total answers: 1

How to make SQLAlchemy in Tornado to be async?

How to make SQLAlchemy in Tornado to be async? Question: How to make SQLAlchemy in Tornado to be async ? I found example for MongoDB on async mongo example but I couldn’t find anything like motor for SQLAlchemy. Does anyone know how to make SQLAlchemy queries to execute with tornado.gen ( I am using MySQL …

Total answers: 6

Tornado – 'Global variables' in tornado?

Tornado – 'Global variables' in tornado? Question: class MainHandler(BaseHandler): @tornado.web.authenticated def get(self): self.render(“index.html”, messages=MessageMixin.cache) So the MainHandler does not pass request or current_user to index.html. But in index.html I tried <p>{{ current_user }}</p> <p>{{ request }}</p> and then there’s a lot of output generated. So is this some kind of ‘global variable’ in Tornado ? …

Total answers: 4