This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/app.py

44 lines
1 KiB
Python

import logging
import os
import stripe
from flask import Flask
from flask.ext.principal import Principal
from flask.ext.login import LoginManager
from flask.ext.mail import Mail
from config import ProductionConfig, DebugConfig, LocalHostedConfig
from util import analytics
app = Flask(__name__)
logger = logging.getLogger(__name__)
stack = os.environ.get('STACK', '').strip().lower()
if stack.startswith('prod'):
logger.info('Running with production config.')
config = ProductionConfig()
elif stack.startswith('localhosted'):
logger.info('Running with debug config on production data.')
config = LocalHostedConfig()
else:
logger.info('Running with debug config.')
config = DebugConfig()
app.config.from_object(config)
logger = logging.getLogger(__name__)
Principal(app, use_sessions=True)
login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'signin'
mail = Mail()
mail.init_app(app)
stripe.api_key = app.config['STRIPE_SECRET_KEY']
mixpanel = analytics.init_app(app)