Skip to content

Commit

Permalink
Set-up settings and static files for Heroku deployment.
Browse files Browse the repository at this point in the history
  • Loading branch information
codylovell committed Nov 12, 2017
1 parent 9e7d161 commit eb343a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions learning_log/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,23 @@
BOOTSTRAP3 = {
'include_jquery': True
}

#heroku settings
cwd = os.getcwd()
if cwd == '/app' or cwd[:4] == '/tmp':
import dj_database_url
DATABASES = {
'default': dj_database_url.config(default='postgres://localhost')
}
#Homor the 'X-Forawarded-Proto' headre for request.is_secure().
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

#Allow all host headers.
ALLOWED_HOSTS = ['*']

#static asset configuration
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = 'staticfiles'
STATICFILES_DIR = (
os.path.join(BASE_DIR, 'static')
)
3 changes: 2 additions & 1 deletion learning_log/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import os

from django.core.wsgi import get_wsgi_application
from dj_static import Cling

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

application = get_wsgi_application()
application = Cling(get_wsgi_application())

0 comments on commit eb343a7

Please sign in to comment.