From 8adf2b550437de8a3a627f2119a142a0c119698e Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Sun, 8 Sep 2013 19:27:08 -0700
Subject: [PATCH] added pooling

---
 Procfile         | 2 +-
 requirements.txt | 1 +
 settings.py      | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Procfile b/Procfile
index ff40e15..60b0579 100644
--- a/Procfile
+++ b/Procfile
@@ -1,2 +1,2 @@
-web: gunicorn wsgi:application
+web: gunicorn wsgi:application -b 0.0.0.0:$PORT -w 8
 worker: python manage.py celeryd -E -B --beat
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index c19cef7..952a2d5 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -17,3 +17,4 @@ dj_database_url==0.2.2
 django-sslify==0.2
 django_webtest==1.7.5
 webtest==2.0.7
+django-db-pool==0.0.10
diff --git a/settings.py b/settings.py
index 8df9806..c7e9ea2 100644
--- a/settings.py
+++ b/settings.py
@@ -28,6 +28,8 @@ DATABASES = {
 if get_from_env('DATABASE_URL', None):
     import dj_database_url
     DATABASES['default'] =  dj_database_url.config()
+    DATABASES['default']['ENGINE'] = 'dbpool.db.backends.postgresql_psycopg2'
+    DATABASES['default']['OPTIONS'] = {'MAX_CONNS': 1}
 
 # Local time zone for this installation. Choices can be found here:
 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
-- 
GitLab