{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import tornado.ioloop\n", "import tornado.web\n", "\n", "class MainHandler(tornado.web.RequestHandler):\n", " def get(self):\n", " self.write(\"Hello, world\")\n", "\n", "def make_app():\n", " return tornado.web.Application([\n", " (r\"/\", MainHandler),\n", " ])\n", "\n", "if __name__ == \"__main__\":\n", " app = make_app()\n", " app.listen(8889)\n", " tornado.ioloop.IOLoop.current().start()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ ">" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "io = tornado.ioloop.IOLoop.current()" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": true }, "outputs": [], "source": [ "class MainHandler(tornado.web.RequestHandler):\n", " def get(self):\n", " self.write(\"Hello, world\")\n", "\n", "def make_app():\n", " return tornado.web.Application([\n", " (r\"/hello\", MainHandler),\n", " ])" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 0 }