From f9da3c74b9d5eb3e7b335f5eafc66da7041df366 Mon Sep 17 00:00:00 2001 From: James Wang Date: Wed, 23 Dec 2015 17:24:37 -0500 Subject: [PATCH 1/3] Calculate number of workers for gunicorn --- deploy | 2 +- scripts/gunicorn.py.ini | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 scripts/gunicorn.py.ini diff --git a/deploy b/deploy index 4789c79..fc3edc2 100755 --- a/deploy +++ b/deploy @@ -7,4 +7,4 @@ sudo service nginx stop echo "Starting the server..." cd /home/vagrant/server sudo service nginx start -gunicorn --bind 0.0.0.0:8000 -w 1 "app:app" \ No newline at end of file +gunicorn "app:app" -c /home/vagrant/scripts/gunicorn.py.ini diff --git a/scripts/gunicorn.py.ini b/scripts/gunicorn.py.ini new file mode 100644 index 0000000..d8cdb2c --- /dev/null +++ b/scripts/gunicorn.py.ini @@ -0,0 +1,4 @@ +from multiprocessing import cpu_count + +bind = "0.0.0.0:8000" +workers = cpu_count() * 2 + 1 From 49d16a1306f118234d2c14609b9191139de28bac Mon Sep 17 00:00:00 2001 From: James Wang Date: Wed, 23 Dec 2015 17:27:56 -0500 Subject: [PATCH 2/3] Remove unused imports --- server/app.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/app.py b/server/app.py index 4478f59..197d279 100644 --- a/server/app.py +++ b/server/app.py @@ -3,9 +3,6 @@ from flask import Flask import config import json -import sys - -from flask import Flask app = Flask(__name__) app.secret_key = config.SECRET From d3b15e4345a721a614eb3ec5835f0da2f8be92ec Mon Sep 17 00:00:00 2001 From: James Wang Date: Wed, 23 Dec 2015 17:32:10 -0500 Subject: [PATCH 3/3] Fix import in __init__.py --- server/api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/api/__init__.py b/server/api/__init__.py index 5b42b9b..2c4eac3 100644 --- a/server/api/__init__.py +++ b/server/api/__init__.py @@ -1 +1 @@ -import api.models \ No newline at end of file +import models \ No newline at end of file