Commit b952b644975c19ca49de14d699940fa18bb8dff8

Authored by Antoine Goutenoir
1 parent e2637443
Exists in master

Disable email sending when not in production.

Showing 1 changed file with 5 additions and 1 deletions   Show diff stats
flaskr/extensions.py
... ... @@ -2,6 +2,7 @@ import sys
2 2 import traceback
3 3 from os import getenv
4 4  
  5 +
5 6 from flask_admin import Admin
6 7 from flask_basicauth import BasicAuth
7 8 from flask_caching import Cache
... ... @@ -12,6 +13,7 @@ from flask_mail import Mail, Message
12 13  
13 14 from flaskr.models import User
14 15  
  16 +
15 17 # Setup flask cache
16 18 cache = Cache()
17 19  
... ... @@ -41,7 +43,9 @@ def load_user(userid):
41 43  
42 44 def send_email(to_recipient, subject, message):
43 45  
44   - print(getenv('MAIL_PORT'))
  46 + if 'production' != getenv('FLASK_ENV', 'production'):
  47 + print("Skipping sending email because we are not in production.")
  48 + return
45 49  
46 50 try:
47 51 msg = Message(
... ...