Beispiel #1
0
def create_app(config):
    """Creates a new Timeless webapp given a config class"""
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_object(config)
    CACHE.init_app(app, config=app.config.get("CACHE_SETTINGS"))
    initialize_extensions(app)
    register_endpoints(app)
    # ensure the instance folder exists
    try:
        os.makedirs(app.instance_path)
    except OSError:
        pass

    @app.route("/")
    def main():
        return "Hello, World!"

    return app
Beispiel #2
0
def clear_cache(app):
    """ Clean the cache for every test """
    with app.app_context():
        CACHE.clear()