Example #1
0
import os, threading
from flask import Flask
from utils import get_instance_folder_path
from configuration import configure_app
from loader_cron import init_loader_cron

import logging
logger = logging.getLogger(__name__)

app = Flask(__name__, instance_path=get_instance_folder_path(), instance_relative_config=True)
configure_app(app)

with app.app_context():
    from routes import *
    app.register_blueprint(routes)

def runApp(msg):
    """Run Main Application"""
    logger.info(msg)
    app.run(os.environ['SERVER_HOST'], port=int(os.environ["SERVER_PORT"]))

def runCron(msg):
    """Run Loader Cron"""
    logger.info(msg)
    if os.environ.get("ACTIVATE_LOADER_CRON", 0) == "1":
        logger.info("Loader CRON is activated")
        init_loader_cron(os.environ.get("LOADER_CRON_SCHEDULE", 10))
    else:
        logger.info("Loader CRON is deactivated")

CronThread = threading.Thread(target=runCron, args=("Boticot Loader Cron starting",))
Example #2
0
from werkzeug import secure_filename
from flask import Flask, request, redirect, url_for
from flask import render_template

from api.webapi import webapi
from db import init_db
from db import db_session
from config import configure_app
from utils import get_instance_folder_path
from bundle_config import configure_bundle

ALLOWED_EXTENSIONS = set(['csv'])

app = Flask(__name__,
            instance_path=get_instance_folder_path(),
            instance_relative_config=True)

def create_app(env):
    configure_app(app, env)
    # setup Blueprint
    app.register_blueprint(webapi)
    # init_db()
    configure_bundle(app)

    return app

def allowed_file(filename):
    return '.' in filename and \
           filename.rsplit('.', 1)[1] in ALLOWED_EXTENSIONS
Example #3
0
import os, threading
from flask import Flask
from utils import get_instance_folder_path
from configuration import configure_app
from training_cron import init_training_cron

import logging

logger = logging.getLogger(__name__)

app = Flask(__name__,
            instance_path=get_instance_folder_path(),
            instance_relative_config=True)
configure_app(app)

with app.app_context():
    from routes import *
    app.register_blueprint(routes)


def runApp(msg):
    """Run Main Application"""
    logger.info(msg)
    app.run(os.environ['SERVER_HOST'],
            port=int(os.environ.get("SERVER_PORT")),
            use_reloader=False)


def runCron(msg):
    """Run Training Cron"""
    logger.info(msg)