Skip to content

Commit

Permalink
Merge 0664c38 into 6be1225
Browse files Browse the repository at this point in the history
  • Loading branch information
sekayasin committed Nov 30, 2018
2 parents 6be1225 + 0664c38 commit ec541ee
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,6 @@ db.sqlite3

# IDE
.vscode/

# Django
authors/apps/authentication/migrations/
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ language: python
python:
- "3.6"

services:
- postgresql

before_script:
- psql -c 'create database ah_zeus_db;' -U postgres

install:
- pip install -r requirements.txt

Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn authors.wsgi --log-file -
23 changes: 18 additions & 5 deletions authors/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"""

import os
import dj_database_url
import django_heroku

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
Expand All @@ -19,12 +21,12 @@
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '7pgozr2jn7zs_o%i8id6=rddie!*0f0qy3$oy$(8231i^4*@u3'
SECRET_KEY = os.environ.get('PROD_SECRET_KEY','7pgozr2jn7zs_o%i8id6=rddie!*0f0qy3$oy$(8231i^4*@u3')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = bool(os.environ.get('PROD_DEBUG', True))

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['.herokuapp.com']

# Application definition

Expand Down Expand Up @@ -80,11 +82,19 @@

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get("DB_NAME", 'ah_zeus_db'),
'USER': os.environ.get("DB_USER", 'postgres'),
'PASSWORD': os.environ.get("DB_PASS", ''),
'HOST': os.environ.get("DB_HOST", '127.0.0.1'),
'PORT': os.environ.get("DB_PORT", '5432'),
}
}

# Heroku $DATABASE_URL - update database configuration
heroku_db_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(heroku_db_env)

# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators

Expand Down Expand Up @@ -140,3 +150,6 @@
# 'authors.apps.authentication.backends.JWTAuthentication',
# ),
}

# Configure Django App for Heroku.
django_heroku.settings(locals())
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@ certifi==2018.10.15
chardet==3.0.4
coverage==4.5.2
coveralls==1.5.1
dj-database-url==0.5.0
Django==2.1
django-cors-headers==2.4.0
django-cors-middleware==1.3.1
django-extensions==2.1.2
django-heroku==0.3.1
djangorestframework==3.8.2
docopt==0.6.2
idna==2.7
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
gunicorn==19.9.0
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
psycopg2-binary==2.7.6.1
PyJWT==1.4.2
pylint==2.2.1
pytz==2018.7
requests==2.20.1
six==1.11.0
urllib3==1.24.1
whitenoise==4.1.2
wrapt==1.10.11
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.7.1

0 comments on commit ec541ee

Please sign in to comment.