Skip to content

Commit

Permalink
use the console email backend by default, which is good for local tes…
Browse files Browse the repository at this point in the history
…ting, or sparkpost if a setting is set

fixes #144
  • Loading branch information
JoshData committed Jul 31, 2017
1 parent ce09e6d commit 647e164
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions settings.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ FACEBOOK_AUTH_SCOPE=email
GOOGLE_APP_ID=fill this in
GOOGLE_APP_SECRET=fill this in
GOOGLE_AUTH_SCOPE="openid email"
SPARKPOST_API_KEY=fill this in
9 changes: 2 additions & 7 deletions settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@
CSRF_COOKIE_SECURE = not DEBUG # similarly
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' # needed by openid login

EMAIL_HOST = 'localhost'
EMAIL_PORT = 587
#EMAIL_HOST_USER = ''
#EMAIL_HOST_PASSWORD = ''
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_SUBJECT_PREFIX = '[GovTrack] '

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
Expand Down Expand Up @@ -170,9 +168,6 @@
EMAIL_UPDATES_RETURN_PATH = "GovTrack.us Email Updates <bounces+uid=%[email protected]>"
BOUNCES_UID_REGEX = re.compile(r"<?bounces\+uid=(\d+)@GovTrack\.us>?", re.I)

#if DEBUG: # sometimes we debug in a live environment
# EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# Load settings from the environment
from settings_env import *

Expand Down
9 changes: 9 additions & 0 deletions settings_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,19 @@ def get_env_boolvar(var_name, default=NOT_SET):
"GOOGLE_ANALYTICS_KEY",
"TWITTER_ACCESS_TOKEN", # for automated tweets and to update @GovTrack/Members-of-Congress twitter list
"TWITTER_ACCESS_TOKEN_SECRET",
"SPARKPOST_API_KEY",
]
for var in copy_env_vars:
locals()[var] = get_env_variable(var, default='')

if SPARKPOST_API_KEY:
EMAIL_BACKEND = 'sparkpost.django.email_backend.SparkPostEmailBackend'
SPARKPOST_OPTIONS = {
'track_opens': False,
'track_clicks': False,
'transactional': True,
}

# TODO. The ad-free payment requires something like this:
#import paypalrestsdk
#paypalrestsdk.configure(mode="sandbox", client_id="...", client_secret="...")
Expand Down

0 comments on commit 647e164

Please sign in to comment.