From 5d0854d2051ea48018465bb9aaec2245e17adbfa Mon Sep 17 00:00:00 2001 From: David Brawand Date: Tue, 20 Sep 2016 11:46:00 +0100 Subject: [PATCH] added gunicorn webserver --- Makefile | 6 ++++++ wsgi.py | 6 ++++++ zippy/views.py | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 wsgi.py diff --git a/Makefile b/Makefile index 8e26ce0..5032bfe 100755 --- a/Makefile +++ b/Makefile @@ -57,6 +57,12 @@ zippy-install: mkdir -p $(ZIPPYVAR)/results chmod -R 777 $(ZIPPYVAR) +# gunicorn/nginx webserver +unicorn: + apt-get install nginx + # start gunicorn with + # gunicorn --bind 0.0.0.0:8000 wsgi:app + # webservice install (production) webservice: rsync -a --exclude-from=.gitignore . $(ZIPPYPATH) diff --git a/wsgi.py b/wsgi.py new file mode 100755 index 0000000..1b393e8 --- /dev/null +++ b/wsgi.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python + +from zippy import app + +if __name__=="__main__": + app.run() diff --git a/zippy/views.py b/zippy/views.py index 0a89e63..3aefbf8 100755 --- a/zippy/views.py +++ b/zippy/views.py @@ -152,7 +152,7 @@ def updatePrimerLocation(): print >> sys.stderr, 'Please fill in all fields (PrimerName VesselNumber Well)' return render_template('location_updated.html', status=None) # read config - with open(app.config['CONFIG_FILE']) as conf: + with open(app.config['CONFIG_FILE']) as conf: config = json.load(conf, object_hook=ascii_encode_dict) db = PrimerDB(config['database']) # run zippy and render