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

49 lines
1.2 KiB
Python
Raw Normal View History

2013-09-23 16:37:40 +00:00
import logging
import os
2013-10-02 04:48:03 +00:00
import stripe
2013-09-23 16:37:40 +00:00
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,
2014-03-05 00:41:48 +00:00
TestConfig, StagingConfig)
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()
2014-03-05 00:40:29 +00:00
elif stack.startswith('staging'):
logger.info('Running with staging config on production data.')
config = StagingConfig()
elif stack.startswith('localhosted'):
logger.info('Running with debug config on production data.')
config = LocalHostedConfig()
elif stack.startswith('test'):
logger.info('Running with test config on ephemeral data.')
config = TestConfig()
else:
logger.info('Running with debug config.')
config = DebugConfig()
app.config.from_object(config)
Principal(app, use_sessions=True)
2013-09-23 16:37:40 +00:00
login_manager = LoginManager()
login_manager.init_app(app)
mail = Mail()
mail.init_app(app)
2013-10-02 04:48:03 +00:00
stripe.api_key = app.config.get('STRIPE_SECRET_KEY', None)
mixpanel = app.config['ANALYTICS'].init_app(app)