How should the startup of a flask app be structured?

Solution
/home/user/Projects/flask-tutorial
├── flaskr/
│   ├── __init__.py
│   ├── db.py
│   ├── schema.sql
│   ├── auth.py
│   ├── blog.py
│   ├── templates/
│   │   ├── base.html
│   │   ├── auth/
│   │   │   ├── login.html
│   │   │   └── register.html
│   │   └── blog/
│   │       ├── create.html
│   │       ├── index.html
│   │       └── update.html
│   └── static/
│       └── style.css
├── tests/
│   ├── conftest.py
│   ├── data.sql
│   ├── test_factory.py
│   ├── test_db.py
│   ├── test_auth.py
│   └── test_blog.py
├── venv/
├── setup.py
└── MANIFEST.in
# flaskr/__init__.py
import os

from flask import Flask


def create_app(test_config=None):
    # create and configure the app
    app = Flask(__name__, instance_relative_config=True)
    app.config.from_mapping(
        SECRET_KEY='dev',
        DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
    )

    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.from_mapping(test_config)

    # ensure the instance folder exists
    try:
        os.makedirs(app.instance_path)
    except OSError:
        pass

    # a simple page that says hello
    @app.route('/hello')
    def hello():
        return 'Hello, World!'

    return app
$ export FLASK_APP=flaskr
$ export FLASK_ENV=development
$ flask run
from flask import Blueprint, render_template, abort
from jinja2 import TemplateNotFound

simple_page = Blueprint('simple_page', __name__,
                        template_folder='templates')

@simple_page.route('/', defaults={'page': 'index'})
@simple_page.route('/')
def show(page):
    try:
        return render_template(f'pages/{page}.html')
    except TemplateNotFound:
        abort(404)
def create_app(test_config=None):
    app = Flask(__name__, instance_relative_config=True)
    # configure the app
    .
    .
    .
    from yourapplication.simple_page import simple_page
    app.register_blueprint(simple_page)
    return app
# flaskr/blueprints/__init__.py
from flaskr.blueprints.simple_page import simple_page
def init_blueprints(app):
    with app.app_context():
        app.register_blueprint(simple_page)
from flaskr.blueprints import init_blueprints
def create_app(test_config=None):
    app = Flask(__name__, instance_relative_config=True)
    # configure the app
    .
    .
    .
    init_blueprints(app)
    return app

ma = Marshmallow()

def create_app(test_config=None):
    app = Flask(__name__, instance_relative_config=True)
    # configure the app
    .
    .
    .
    init_blueprints(app)
    ma.init_app(app)
    return app
$ gunicorn "flaskr:create_app()"