Get root path of Flask application
app.root_path contains the root path for the application. This is determined based on the name passed to Flask. Typically, you should use the instance path (app.instance_path) not the root path, as the instance path will not be within the package code. filename = os.path.join(app.instance_path, ‘my_folder’, ‘my_file.txt’)