Skip to content

Commit

Permalink
updated settings etcetera to deploy on herokuclear
Browse files Browse the repository at this point in the history
  • Loading branch information
esoergel committed Jun 28, 2013
1 parent efde771 commit e83ec39
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 11 deletions.
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web: python manage.py runserver 0.0.0.0:$PORT --noreload
web: gunicorn peacecorps.wsgi

2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "peacecorps.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "peacecorps.settings.main")

from django.core.management import execute_from_command_line

Expand Down
1 change: 0 additions & 1 deletion peacecorps/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from development import *
6 changes: 4 additions & 2 deletions peacecorps/settings/development.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from common import *
import os

DEBUG = True
DEBUG = os.environ.get('DJANGO_DEBUG', "True").lower() == "true"

DATABASES = {
'default': {
Expand All @@ -18,6 +18,8 @@
MEDIA_ROOT = "media"
MEDIA_URL = "http://localhost:8000/media/"

ALLOWED_HOSTS = ['*']

try:
from localenv import *
except ImportError:
Expand Down
26 changes: 24 additions & 2 deletions peacecorps/settings/common.py → peacecorps/settings/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import os

# set environment variables:
# SECRET_KEY
# DJANGO_ENV ("DEV" or "PRODUCTION") - defaults to DEV
# DJANGO_DEBUG (True or False) - defaults to True in DEV, False in PRODUCTION


ADMINS = (
('u45127', '[email protected]'),
)
Expand Down Expand Up @@ -68,7 +74,8 @@
)

# Make this unique, and don't share it with anybody.
SECRET_KEY = '-tvq%*!rhbajbg)_nn1#ul55w-mhtzdhgisunqc%__ya$my%#l'
SECRET_KEY = os.environ.get("SECRET_KEY", "this is supposed to be a secret...")


TEMPLATE_CONTEXT_PROCESSORS = (
'django.contrib.auth.context_processors.auth',
Expand Down Expand Up @@ -157,7 +164,22 @@
}
}

DJANGO_ENV = os.environ.get("DJANGO_ENV") # PRODUCTION, TEST, or DEV
###############
# Environment #
###############


DJANGO_ENV = os.environ.get('DJANGO_ENV', 'DEV') # PRODUCTION, TEST, or DEV

# You can set DEBUG in either setting, but it defaults to
# True locally and False on the server
if DJANGO_ENV == "PRODUCTION":
from .production import *
else:
from .development import *


TEMPLATE_DEBUG = DEBUG

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
Expand Down
19 changes: 15 additions & 4 deletions peacecorps/settings/production.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
import os
import dj_database_url

from common import *
DEBUG = os.environ.get('DJANGO_DEBUG', "False").lower() == "true"

DEBUG = False
TEMPLATE_DEBUG = False
DEBUG_SQL = False


DATABASES = {
'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))
}

ALLOWED_HOSTS = ['peacecorps.herokuapp.com']


#####################
# SENDGRID SETTINGS #
#####################

EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
EMAIL_HOST_PASSWORD = os.environ['SENDGRID_PASSWORD']
EMAIL_PORT = 587 # 25, 587, 2525 and 465 on ssl
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = '[email protected]'
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
Django==1.5.1
Pillow==2.0.0
Pygments==1.6
South==0.8.1
argparse==1.2.1
bpython==0.12
distribute==0.6.24
django-braces==1.0.0
django-taggit==0.10a1
gunicorn==0.17.4
wsgiref==0.1.2

0 comments on commit e83ec39

Please sign in to comment.