<filename>app/__init__.py
import os
from flask import Flask

def create_app(test_config=None):
    """Create and configure an instance of the Flask application."""
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_mapping(
        DEBUG=True,
        UPLOAD_FOLDER="/tmp/uploads"
    )
    if test_config is None:
        # load the instance config, if it exists, when not testing
        app.config.from_pyfile("config.py", silent=True)
    else:
        # load the test config if passed in
        app.config.update(test_config)
        
    # ensure the instance folder exists
    try:
        os.makedirs(app.instance_path)
    except OSError:
        pass

    if not os.path.isdir(app.config['UPLOAD_FOLDER']):
        os.mkdir(app.config['UPLOAD_FOLDER'])

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

    # register API blueprint
    from app.api import api
    app.register_blueprint(api, url_prefix="/api/v1")

    return app

<filename>app/__init__.py
import os
from flask import Flask

def create_app(test_config=None):
    """Create and configure an instance of the Flask application."""
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_mapping(
        DEBUG=True,
        UPLOAD_FOLDER="/tmp/uploads"
    )
    if test_config is None:
        # load the instance config, if it exists, when not testing
        app.config.from_pyfile("config.py", silent=True)
    else:
        # load the test config if passed in
        app.config.update(test_config)
        
    # ensure the instance folder exists
    try:
        os.makedirs(app.instance_path)
    except OSError:
        pass

    if not os.path.isdir(app.config['UPLOAD_FOLDER']):
        os.mkdir(app.config['UPLOAD_FOLDER'])

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

    # register API blueprint
    from app.api import api
    app.register_blueprint(api, url_prefix="/api/v1")

    return app

Create and configure an instance of the Flask application. # load the instance config, if it exists, when not testing # load the test config if passed in # ensure the instance folder exists # register API blueprint