From 160ee4473baa5dbe8493ee63d4b71bf0678f03d3 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:14:55 +0100 Subject: [PATCH 1/8] Nowadays stuff is called "App". --- server.py => app.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename server.py => app.py (100%) diff --git a/server.py b/app.py similarity index 100% rename from server.py rename to app.py From 8eeea4b7d3a193edec00a8f66fc035e3401499bb Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:16:43 +0100 Subject: [PATCH 2/8] Prepare app for Heroku. --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 97a7e62..93ccca7 100755 --- a/app.py +++ b/app.py @@ -24,4 +24,5 @@ def showMap(threewords): if __name__ == '__main__': - run(host='localhost', port=8080) + import os + run(host='0.0.0.0', port=int(os.environ.get("PORT", 5000))) From c6ccdac1937d1ee62e93a30718d89c2ef29eaa64 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:16:56 +0100 Subject: [PATCH 3/8] Add requirements. Does this work this way? --- requirements.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d8713a5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +thesethreewords +geohash>=1.0 +bottle>=0.12.7 From db3d286f70f448332abb9d722af3a3658b9ed5ff Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:20:32 +0100 Subject: [PATCH 4/8] Fix requirements. --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d8713a5..2dc37bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,2 @@ -thesethreewords geohash>=1.0 bottle>=0.12.7 From 6119fea49799aafb64fc8c2e3fbba67ef64e3d55 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:26:07 +0100 Subject: [PATCH 5/8] Fix requirements again. Should work now. --- requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 2dc37bc..341da8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -geohash>=1.0 -bottle>=0.12.7 +python-geohash==0.8.5 +bottle==0.12.7 From 2abcf46b307d9d0a9308e8d7434b70c1bde50d57 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:32:49 +0100 Subject: [PATCH 6/8] Add Procfile. --- Procfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..ebb67b2 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: python ./app.py From eed50f8ac6f8b040a47f8589586150b4255e3329 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:42:06 +0100 Subject: [PATCH 7/8] Preserve functionality to run locally. On the server the app is now run by gunicorn. --- Procfile | 2 +- app.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Procfile b/Procfile index ebb67b2..538ca43 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: python ./app.py +web: gunicorn app --log-file - diff --git a/app.py b/app.py index 93ccca7..db4659f 100755 --- a/app.py +++ b/app.py @@ -24,5 +24,6 @@ def showMap(threewords): if __name__ == '__main__': - import os - run(host='0.0.0.0', port=int(os.environ.get("PORT", 5000))) + run(host='localhost', port=8080) + +app = bottle.default_app() From c08ef2d10c82a268fba797b8beefb01cb7fc1af9 Mon Sep 17 00:00:00 2001 From: Kevin Dungs Date: Mon, 17 Nov 2014 15:44:39 +0100 Subject: [PATCH 8/8] Fix import --- app.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app.py b/app.py index db4659f..e125455 100755 --- a/app.py +++ b/app.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import bottle from bottle import ( get, run, @@ -13,6 +14,7 @@ import thesethreewords as these def index(): return template('index', err=None) + @get('/') def showMap(threewords): try: