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

48 lines
1.1 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
import json
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 storage import Storage
from config import DefaultConfig
from data.userfiles import Userfiles
app = Flask(__name__)
logger = logging.getLogger(__name__)
logger.debug('Loading default config.')
app.config.from_object(DefaultConfig())
if 'QUAY_CONFIG_FILE' in os.environ:
config_filename = os.environ['QUAY_CONFIG_FILE']
logger.debug('Applying config file: %s', config_filename)
app.config.from_pyfile(config_filename)
overrides = json.loads(os.environ.get('QUAY_CONFIG', '{}'))
logger.debug('Applying %s config overrides.', len(overrides))
app.config.from_object(overrides)
Principal(app, use_sessions=False)
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
storage = Storage()
storage.init_app(app)
userfiles = Userfiles()
userfiles.init_app(app)
stripe.api_key = app.config.get('STRIPE_SECRET_KEY', None)
mixpanel = app.config['ANALYTICS'].init_app(app)