Confuguration method in get_db

def get_db():
“”"
Configuration method to return db instance
“”"
db = getattr(g, “_database”, None)
MFLIX_DB_URI = current_app.config[“MFLIX_DB_URI”]
if db is None:

Can you please explain me the above lines used in db.py??

The documentation for the python builtin function getattr is at https://docs.python.org/3/library/functions.html#getattr.

MFLIX_DB_URI is a variable to which we assigned the value of the MFLIX_DB_URI entry from the associative array current_app.config.

what is g and current_app here??