示例#1
0
import flask
import os
import logging

from flask_heroku import Heroku
from flask_redis import Redis
from flask_sslify import SSLify
from flask_sqlalchemy import SQLAlchemy
from raven.contrib.flask import Sentry
from werkzeug.contrib.fixers import ProxyFix

from freight.api.controller import ApiController
from freight.constants import PROJECT_ROOT
from freight.utils.celery import ContextualCelery

api = ApiController(prefix='/api/0')
db = SQLAlchemy(session_options={})
celery = ContextualCelery()
heroku = Heroku()
redis = Redis()
sentry = Sentry(logging=True, level=logging.WARN)


def configure_logging(app):
    logging.getLogger().setLevel(getattr(logging, app.config['LOG_LEVEL']))


def create_app(_read_config=True, **config):
    from kombu import Queue

    app = flask.Flask(__name__,
示例#2
0
import logging
from urllib.parse import urlunsplit

from flask_heroku import Heroku
from flask_redis import FlaskRedis
from flask_sslify import SSLify
from flask_sqlalchemy import SQLAlchemy
from raven.contrib.flask import Sentry
from werkzeug.middleware.proxy_fix import ProxyFix

from freight.queue import Queue
from freight.api.controller import ApiController
from freight.constants import PROJECT_ROOT


api = ApiController(prefix="/api/0")
db = SQLAlchemy(session_options={})
heroku = Heroku()
redis = FlaskRedis()
sentry = Sentry(logging=True, level=logging.WARN)
queue = Queue()


def configure_logging(app):
    logging.getLogger().setLevel(getattr(logging, app.config["LOG_LEVEL"]))


def create_app(_read_config=True, **config):
    app = flask.Flask(
        __name__,
        static_folder=None,