Exemplo n.º 1
0
def get_redis():
    """Opens a new database connection if there is none yet."""
    if not hasattr(g, 'redis'):
        if app.testing:
            rs = FlaskRedis.from_custom_provider(app.config['REDIS_PROVIDER'])
        else:
            rs = FlaskRedis()

        rs.init_app(app)
        g.redis = rs

    return g.redis
Exemplo n.º 2
0
Arquivo: app.py Projeto: dotzero/Pad
def get_redis():
    """Opens a new database connection if there is none yet."""
    if not hasattr(g, 'redis'):
        if app.testing:
            rs = FlaskRedis.from_custom_provider(app.config['REDIS_PROVIDER'])
        else:
            rs = FlaskRedis()

        rs.init_app(app)
        g.redis = rs

    return g.redis
Exemplo n.º 3
0
    app
    ~~~

    TTLD app
"""

import os
from flask import Flask, render_template
from flask.ext.redis import FlaskRedis

redis_store = FlaskRedis()

app = Flask(__name__)
app.config.from_object('app_config')
if os.getenv('ENV_STAGE', 'dev') == 'test':
    app.config.from_object('tests.settings')

redis_store.init_app(app)


@app.route('/')
def index():
    return render_template('index.html', body_class="index")

@app.route('/entry')
def entry():
    return render_template('entry.html', body_class="entry")

if __name__ == '__main__':
    app.run(debug=True)
Exemplo n.º 4
0
            'threatresponse',
            static_folder='../static',
            template_folder='../templates',
            )

    app.config.from_object('config')  # Load from config.py
    app.config.from_object(settings)
    FlaskRedis(app, 'REDIS')
    return app


app = create_app()

FlaskMustache.attach(app)
#mustache().init_app(app)
redis_store.init_app(app)

app.config.update(
    TEMPLATES_AUTO_RELOAD = True
)

assets = Environment(app)
assets.url = app.static_url_path


# for development
# Don't cache otherwise it won't build every time
assets.cache = False
assets.manifest = False
app.config['ASSETS_DEBUG'] = True