Пример #1
0
def create_app(config_name):
	#note_1
	app = Flask(__name__)

	
	app.config.from_object(config[config_name])
	config[config_name].init_app(app)

	
	bootstrap.init_app(app)
	moment.init_app(app)
	db.init_app(app)
	login_manager.init_app(app)

	#register blueprint
	from .main import main as main_blueprint
	app.register_blueprint(main_blueprint)

	from .auth import auth as auth_blueprint
	app.register_blueprint(auth_blueprint, url_prefix='/auth')

	from .sensor import sensor as sensor_blueprint
	app.register_blueprint(sensor_blueprint, url_prefix='/sensor')
	

	return app
Пример #2
0
def create_app():
    """
    Creates & configures flask application object and associates sqlalchemy db object with it.
    """
    app = Flask(__name__, static_url_path='')
    app.debug = is_debug_mode
    app.config['SQLALCHEMY_DATABASE_URI'] = database_driver + database_path
    db.app = app
    db.init_app(app)
    return app