Exemplo n.º 1
0
def create_app():
    """Construct core Flask application with embedded Dash app."""
    app = Flask(__name__, instance_relative_config=False)
    app.config.from_object('config.Config')

    with app.app_context():
        # Import Flask routes

        from application import reaction

        # Import Dash application
        from application.plotlydash.dashboard import create_dashboard
        conn = sqlite3.connect('data/alldata.db',
                               isolation_level=None,
                               check_same_thread=False)
        c = conn.cursor()
        c.execute(
            "CREATE TABLE IF NOT EXISTS ytsentiment(id INTEGER PRIMARY KEY AUTOINCREMENT, unix INTEGER, comments TEXT, sentiment REAL)"
        )
        c.execute(
            "CREATE TABLE IF NOT EXISTS twsentiment(id INTEGER PRIMARY KEY AUTOINCREMENT, screen_name TEXT, timedate TIMESTAMP, texts TEXT, likes INTEGER, retweets INTEGER, replies INTEGER, sentiment REAL)"
        )
        c.execute(
            "CREATE TABLE IF NOT EXISTS rdsentiment(id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, s_score INTEGER, upvote_ratio REAL, comments TEXT, c_score INTEGER , c_date TIMESTAMP, sentiment REAL)"
        )
        app = create_dashboard(app)

        # Compile CSS
        if app.config['FLASK_ENV'] == 'development':
            from application.assets import compile_assets
            compile_assets(app)

        return app
Exemplo n.º 2
0
def init_vendors(app):
    from flask_mail import Mail
    from flask_assets import Environment
    from application.assets import compile_assets
    from application.database import db
    assets = Environment()
    assets.init_app(app)
    compile_assets(assets)
    db.init_app(app)
    db.create_all()
    Mail(app)
Exemplo n.º 3
0
def create_app():
    app = Flask(__name__, instance_relative_config=False)
    app.config.from_object('config.Config')

    with app.app_context():
        from application import routes

        from application.engine.queried import create_queried
        app = create_queried(app)
        # from application.plotlydash.dashboard2 import create_dashboard
        # app = create_dashboard(app)

        if app.config['FLASK_ENV'] == 'development':
            from application.assets import compile_assets
            compile_assets(app)

        return app
Exemplo n.º 4
0
def create_app():
    """Construct core Flask application with embedded Dash app."""
    app = Flask(__name__, instance_relative_config=False)
    app.config.from_object('config.Config')

    with app.app_context():
        # Import Flask routes
        from application import routes

        # Import Dash application
        from application.plotlydash.dashboard import create_dashboard
        app = create_dashboard(app)

        # Compile CSS
        if app.config['FLASK_ENV'] == 'development':
            from application.assets import compile_assets
            compile_assets(app)

        return app
Exemplo n.º 5
0
def create_app():
    """Construct the core application."""
    app = Flask(__name__, instance_relative_config=False)
    app.config.from_object('config.Config')

    with app.app_context():

        # Import main Blueprint
        from application import routes
        app.register_blueprint(routes.main_bp)

        # Import Dash application
        from application.dash_application.dash_example import Add_Dash
        app = Add_Dash(app)

        # Compile assets
        from application.assets import compile_assets
        compile_assets(app)

        return app
Exemplo n.º 6
0
def create_app():
    """Construct core Flask application with embedded Dash app."""
    app = Flask(__name__, instance_relative_config=False)
    app.config.from_object('config.Config')
    assets = Environment()

    with app.app_context():
        # Import Flask routes
        from . import routes

        # Import Dash application
        from application.plotlydash.dashboard import create_dashboard
        app = create_dashboard(app)

        # Compile CSS
        from application.assets import compile_assets
        compile_assets(assets)

        return app
    #ewith


#edef