diff --git a/Procfile b/Procfile index c09a552..1dd8fed 100644 --- a/Procfile +++ b/Procfile @@ -1 +1,2 @@ -web: python manage.py runserver 0.0.0.0:$PORT --noreload +web: gunicorn peacecorps.wsgi + diff --git a/manage.py b/manage.py index 76e6a48..23a4b77 100755 --- a/manage.py +++ b/manage.py @@ -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 diff --git a/peacecorps/settings/__init__.py b/peacecorps/settings/__init__.py index aa27052..e69de29 100644 --- a/peacecorps/settings/__init__.py +++ b/peacecorps/settings/__init__.py @@ -1 +0,0 @@ -from development import * diff --git a/peacecorps/settings/development.py b/peacecorps/settings/development.py index f40b44b..b6010d4 100644 --- a/peacecorps/settings/development.py +++ b/peacecorps/settings/development.py @@ -1,6 +1,6 @@ -from common import * +import os -DEBUG = True +DEBUG = os.environ.get('DJANGO_DEBUG', "True").lower() == "true" DATABASES = { 'default': { @@ -18,6 +18,8 @@ MEDIA_ROOT = "media" MEDIA_URL = "http://localhost:8000/media/" +ALLOWED_HOSTS = ['*'] + try: from localenv import * except ImportError: diff --git a/peacecorps/settings/common.py b/peacecorps/settings/main.py similarity index 89% rename from peacecorps/settings/common.py rename to peacecorps/settings/main.py index 791c5cf..dc9f449 100644 --- a/peacecorps/settings/common.py +++ b/peacecorps/settings/main.py @@ -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', 'thadknull@gmail.com'), ) @@ -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', @@ -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') diff --git a/peacecorps/settings/production.py b/peacecorps/settings/production.py index e8e4beb..e1bb246 100644 --- a/peacecorps/settings/production.py +++ b/peacecorps/settings/production.py @@ -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 = 'thadknull@gmail.com' \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index af0ecb5..09eb3d1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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