code: def create_app(test_config=None):
      """Create and configure an instance of the Flask application."""
      app = Flask(__name__, instance_relative_config=True)
  
      # some deploy systems set the database url in the environ
      db_url = os.environ.get("DATABASE_URL")
  
      if db_url is None:
          # default to a sqlite database in the instance folder
          db_url = "sqlite:///flaskr.sqlite"
  
      app.config.from_mapping(
          # default secret that should be overridden in environ or config
          SECRET_KEY=os.environ.get("SECRET_KEY", "dev"),
          SQLALCHEMY_DATABASE_URI=db_url,
      )
  
      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)
  
      # initialize Flask-SQLAlchemy and the init-db command
      db.init_app(app)
      app.cli.add_command(init_db_command)
  
      # apply the blueprints to the app
      from flaskr import auth, blog
  
      app.register_blueprint(auth.bp)
      app.register_blueprint(blog.bp)
  
      # make "index" point at "/", which is handled by "blog.index"
      app.add_url_rule("/", endpoint="index")
  
      return app
  
file_path: flask-sqlalchemy/examples/flaskr/flaskr/__init__.py
imports: import os
  import click
  from flask import Flask
  from flask.cli import with_appcontext
  from flask_sqlalchemy import SQLAlchemy
  from sqlalchemy.orm import DeclarativeBase
label_desc: Use image node_id 1 for calling a global function with example usage: create_app(test_config) and returns: app