From 9c91f00cb416b5952a5abc81508906c16dfb1c6f Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Wed, 9 May 2018 14:00:40 +0800 Subject: [PATCH] Replace Werkzeug with Bjoern as underlying WSGI server (#672) --- environments/python/Dockerfile | 2 +- environments/python/Dockerfile-2.7 | 2 +- environments/python/requirements.txt | 1 + environments/python/server.py | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/environments/python/Dockerfile b/environments/python/Dockerfile index 483c9156..f4fac883 100644 --- a/environments/python/Dockerfile +++ b/environments/python/Dockerfile @@ -1,7 +1,7 @@ FROM alpine:3.5 RUN apk update -RUN apk add --no-cache python3 python3-dev build-base +RUN apk add --no-cache python3 python3-dev build-base libev-dev RUN pip3 install --upgrade pip RUN rm -r /root/.cache diff --git a/environments/python/Dockerfile-2.7 b/environments/python/Dockerfile-2.7 index be9c736e..87e6455f 100644 --- a/environments/python/Dockerfile-2.7 +++ b/environments/python/Dockerfile-2.7 @@ -1,7 +1,7 @@ FROM alpine:3.5 RUN apk update -RUN apk add --no-cache python python-dev build-base py-pip +RUN apk add --no-cache python python-dev build-base py-pip libev-dev RUN pip install --upgrade pip RUN rm -r /root/.cache diff --git a/environments/python/requirements.txt b/environments/python/requirements.txt index 09d0579a..8f437f24 100644 --- a/environments/python/requirements.txt +++ b/environments/python/requirements.txt @@ -1,4 +1,5 @@ Flask===0.11.1 +bjoern httplib2 python-dateutil requests==2.7.0 diff --git a/environments/python/server.py b/environments/python/server.py index a961e7a9..cf4b216d 100644 --- a/environments/python/server.py +++ b/environments/python/server.py @@ -4,6 +4,7 @@ import logging import sys import imp import os +import bjoern from flask import Flask, request, abort, g @@ -99,4 +100,4 @@ def setup_logger(loglevel): # setup_logger(logging.DEBUG) app.logger.info("Starting server") -app.run(host='0.0.0.0', port=8888) +bjoern.run(app, '0.0.0.0', 8888, reuse_port=True)