Skip to content

Commit

Permalink
Merge pull request #9 from andela/ch-heroku-deployment-150848162
Browse files Browse the repository at this point in the history
#150848162 Heroku deployment
  • Loading branch information
Judith Achieng committed Sep 11, 2017
2 parents 9342bf7 + 8a8a4f7 commit c5c0eaa
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ __pycache__/
*.pyc
.coverage
hc.sqlite

hc-venv/
hc/local_settings.py
static-collected
hc/local_settings.py

.DS_Store
static/.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env:
- DB=postgres
addons:
postgresql: "9.4"
before_script:
- python manage.py compress
script:
- coverage run --omit=*/tests/* --source=hc manage.py test
after_success: coveralls
Expand Down
3 changes: 3 additions & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
release: python manage.py migrate
web: gunicorn hc.wsgi:application

16 changes: 16 additions & 0 deletions hc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@
}
}

if os.getcwd() == "/app":
from dj_database_url import parse
DATABASE_URL = os.getenv('DATABASE_URL')
DATABASES = {
"default": parse(
DATABASE_URL,
conn_max_age = 600
)
}

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'
Expand Down Expand Up @@ -149,6 +159,12 @@
PUSHBULLET_CLIENT_ID = None
PUSHBULLET_CLIENT_SECRET = None

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

ALLOWED_HOSTS = ['*']

DEBUG = False

if os.path.exists(os.path.join(BASE_DIR, "hc/local_settings.py")):
from .local_settings import *
else:
Expand Down
2 changes: 2 additions & 0 deletions hc/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import os

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hc.settings")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
boto==2.48.0
braintree==3.38.0
coverage==4.4.1
coveralls==1.2.0
cssselect==1.0.1
cssutils==1.0.2
dj-database-url==0.4.2
Django==1.10
django-appconf==1.0.1
django-compressor==2.1
django-ses-backend==0.1.1
djmail==0.11.0
docopt==0.6.2
futures==3.0.3
gunicorn==19.7.1
lxml==3.8.0
mock==2.0.0
pbr==3.1.1
Expand All @@ -19,3 +22,4 @@ rcssmin==1.0.6
requests==2.9.1
rjsmin==1.0.12
six==1.10.0
whitenoise==3.3.0
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.5.2

0 comments on commit c5c0eaa

Please sign in to comment.