How to Solve NameError: name 'secure_filename' is not defined -- werkzeug

Erorr: name 'secure_filename' is not defined

NameError: name 'secure_filename' is not defined

Solution: Import the 'secure_filename' module

# Add the following line to the top of your code
from werkzeug.utils import secure_filename

 

For more information:
werkzeug secure_filename