diff --git a/Chapter_One/Lecture_3_Demo/myapp/Dockerfile b/Chapter_One/Lecture_3_Demo/myapp/Dockerfile new file mode 100644 index 0000000..3ded536 --- /dev/null +++ b/Chapter_One/Lecture_3_Demo/myapp/Dockerfile @@ -0,0 +1,8 @@ +FROM python:3.5 + +COPY . /app +WORKDIR /app + +RUN pip install -r requirements.txt + +CMD ["python", "-u", "server.py"] diff --git a/Chapter_One/Lecture_3_Demo/myapp/requirements.txt b/Chapter_One/Lecture_3_Demo/myapp/requirements.txt new file mode 100644 index 0000000..c3368df --- /dev/null +++ b/Chapter_One/Lecture_3_Demo/myapp/requirements.txt @@ -0,0 +1 @@ +tornado diff --git a/Chapter_One/Lecture_3_Demo/myapp/server.py b/Chapter_One/Lecture_3_Demo/myapp/server.py new file mode 100644 index 0000000..c18f83e --- /dev/null +++ b/Chapter_One/Lecture_3_Demo/myapp/server.py @@ -0,0 +1,21 @@ +import tornado.ioloop +import tornado.web + + +class MainHandler(tornado.web.RequestHandler): + def get(self): + self.write("Hello, world\n") + print(self.request) + + +def make_app(): + return tornado.web.Application([ + (r"/", MainHandler), + ]) + + +if __name__ == "__main__": + app = make_app() + app.listen(8888) + tornado.ioloop.IOLoop.current().start() +