extra_files = extra_dirs[:]
for extra_dir in extra_dirs:
    for dirname, dirs, files in os.walk(extra_dir):
        for filename in files:
            filename = path.join(dirname, filename)
if path.isfile(filename):
    extra_files.append(filename)
app.run(extra_files=extra_files)
Reload Flask app when template file changes