From 732243dd6ea05716ff83442648c4b35d1d1e57ed Mon Sep 17 00:00:00 2001 From: Andrew Buss <abuss@ucsd.edu> Date: Sat, 2 May 2015 16:27:55 -0700 Subject: [PATCH] SES only used if access key id is in environemtn --- flashy/settings.py | 43 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/flashy/settings.py b/flashy/settings.py index e8f8de7..d98e54c 100644 --- a/flashy/settings.py +++ b/flashy/settings.py @@ -1,15 +1,3 @@ -""" -Django settings for flashy project. - -Generated by 'django-admin startproject' using Django 1.8. - -For more information on this file, see -https://docs.djangoproject.com/en/1.8/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.8/ref/settings/ -""" - # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os @@ -21,7 +9,6 @@ DEBUG = True ALLOWED_HOSTS = [] AUTH_USER_MODEL = 'flashcards.User' -# Application definition INSTALLED_APPS = ( 'simple_email_confirmation', @@ -56,7 +43,7 @@ MIDDLEWARE_CLASSES = ( ) ROOT_URLCONF = 'flashy.urls' -# Authentication backends + AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) @@ -79,10 +66,6 @@ TEMPLATES = [ WSGI_APPLICATION = 'flashy.wsgi.application' - -# Database -# https://docs.djangoproject.com/en/1.8/ref/settings/#databases - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -90,33 +73,25 @@ DATABASES = { } } - -# Internationalization -# https://docs.djangoproject.com/en/1.8/topics/i18n/ - LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'UTC' - +TIME_ZONE = 'America/Los_Angeles' USE_I18N = True - USE_L10N = True - USE_TZ = True - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/1.8/howto/static-files/ - STATIC_URL = '/static/' STATIC_ROOT = 'static' -EMAIL_BACKEND = 'django_ses.SESBackend' +# Four settings just to be sure EMAIL_FROM = 'noreply@flashy.cards' EMAIL_HOST_USER = 'noreply@flashy.cards' DEFAULT_FROM_EMAIL = 'noreply@flashy.cards' SERVER_EMAIL = 'noreply@flashy.cards' -AWS_SES_REGION_NAME = 'us-west-2' -AWS_SES_REGION_ENDPOINT = 'email.us-west-2.amazonaws.com' +EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' +if 'AWS_ACCESS_KEY_ID' in os.environ: + AWS_SES_REGION_NAME = 'us-west-2' + AWS_SES_REGION_ENDPOINT = 'email.us-west-2.amazonaws.com' + EMAIL_BACKEND = 'django_ses.SESBackend' + SECRET_KEY = os.environ.get('SECRET_KEY', 'LOL DEFAULT SECRET KEY') \ No newline at end of file -- 1.9.1