From 4040ac794f3eb09d8ca327eea06e65448a0375a5 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Thu, 29 Sep 2011 01:27:31 -0400 Subject: [PATCH] gevent runner --- Procfile | 2 +- requirements.txt | 2 +- run_httpbin.py | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100755 run_httpbin.py diff --git a/Procfile b/Procfile index 11bcc81..0ee4503 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: gunicorn httpbin:app -b "0.0.0.0:$PORT" -w 3 \ No newline at end of file +web: python run_httpbin.py $PORT \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c44bc00..e2ee093 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,4 @@ distribute==0.6.15 wsgiref==0.1.2 decorator==3.3.1 omnijson==0.1.2 -gunicorn \ No newline at end of file +gevent \ No newline at end of file diff --git a/run_httpbin.py b/run_httpbin.py new file mode 100755 index 0000000..3d7641b --- /dev/null +++ b/run_httpbin.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +import sys + +from gevent.wsgi import WSGIServer +from httpbin import app + + +try: + port = int(sys.argv[1]) +except (KeyError, ValueError): + port = 5000 + +print 'Starting httpbin on port {0}'.format(port) +http_server = WSGIServer(('', port), app) +http_server.serve_forever() \ No newline at end of file