diff --git a/app/Email/services.py b/app/Email/services.py index 2c951dd..12e7e26 100644 --- a/app/Email/services.py +++ b/app/Email/services.py @@ -1,6 +1,6 @@ from app import mail, app from os.path import expanduser, isfile -from flask.ext.mail import Message +from flask_mail import Message from app.User.coppa import Coppa, SponsorType import pystache diff --git a/app/__init__.py b/app/__init__.py index c5acf7f..584a5c7 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -10,14 +10,13 @@ from os.path import expanduser, isfile # Import Flask -# from flask import Flask, render_template from flask import Flask # Import SQLAlchemy database mapper -from flask.ext.sqlalchemy import SQLAlchemy +from flask_sqlalchemy import SQLAlchemy # Import Mail -from flask.ext.mail import Mail +from flask_mail import Mail # Define the WSGI application object from raven.contrib.flask import Sentry @@ -76,6 +75,8 @@ } logging.basicConfig(level=logging.DEBUG) +logging.info('Log level set to %s', 'DEBUG') +logging.info('Starting Cloud Session Service v%s', version) configfile = expanduser("~/cloudsession.properties") logging.info('Looking for config file: %s', configfile) @@ -85,17 +86,18 @@ configs.readfp(FakeSecHead(open(configfile))) app_configs = {} + logging.debug('Configuration Key Settings') for (key, value) in configs.items('section'): app_configs[key] = value - logging.info("Key:%s, Value:%s", key, value) + logging.debug("Key:%s, Value:%s", key, value) app.config['CLOUD_SESSION_PROPERTIES'] = app_configs else: app.config['CLOUD_SESSION_PROPERTIES'] = defaults + logging.warn('WARNING: Using application defaults.') - -# -------------------------------------- Module initialization ------------------------------------------------- +# ---------- Init Sentry Module ---------- if app.config['CLOUD_SESSION_PROPERTIES']['sentry-dsn'] is not None: logging.info("Initializing Sentry") sentry = Sentry(app, @@ -106,20 +108,27 @@ else: logging.info("No Sentry configuration") +# ---------- Init database package ---------- # Define the database object which is imported # by modules and controllers -# logging.info("Initializing database connection") +# -------------------------------------------- app.config['SQLALCHEMY_DATABASE_URI'] = app.config['CLOUD_SESSION_PROPERTIES']['database.url'] +logging.debug("Initializing database connection: %s", app.config['SQLALCHEMY_DATABASE_URI']) + db = SQLAlchemy(app) -# logging.info("Configuring SMTP properties") app.config['MAIL_SERVER'] = app.config['CLOUD_SESSION_PROPERTIES']['mail.host'] +logging.debug("Configuring SMTP properties for %s", app.config['MAIL_SERVER']) + +# Set the correct server port for encrypted vs unencrypted communications if app.config['CLOUD_SESSION_PROPERTIES']['mail.port'] is None: if app.config['CLOUD_SESSION_PROPERTIES']['mail.tls']: app.config['MAIL_PORT'] = 587 else: app.config['MAIL_PORT'] = 25 + + logging.info("Email server default port set to port %s", app.config['MAIL_PORT']) else: app.config['MAIL_PORT'] = app.config['CLOUD_SESSION_PROPERTIES']['mail.port'] @@ -139,7 +148,7 @@ mail = Mail(app) -# -------------------------------------------- Services -------------------------------------------------------- +# ---------- Services ---------- logging.info("Initializing services") # All of these imports need the database diff --git a/requirements.txt b/requirements.txt index 680ec6b..302ce2b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,22 +1,22 @@ aniso8601==1.1.0 blinker==1.4 contextlib2==0.5.1 -Flask==0.10.1 +Flask==0.12.2 Flask-Mail==0.9.1 Flask-MySQLdb==0.2.0 -Flask-RESTful==0.3.5 -Flask-SQLAlchemy==2.1 +Flask-RESTful==0.3.6 +Flask-SQLAlchemy==2.3.2 itsdangerous==0.24 Jinja2==2.8 MarkupSafe==0.23 -mysqlclient==1.3.7 +mysqlclient==1.3.12 pystache==0.5.4 python-dateutil==2.5.2 pytz==2016.3 -raven==5.12.0 +raven==6.4.0 six==1.10.0 -SQLAlchemy==1.0.12 -validate-email==1.3 +# SQLAlchemy==1.0.12 +SQLAlchemy==1.2.0 Werkzeug==0.11.5 wheel==0.24.0 validate_email==1.3