How to Solve NameError: name 'ContentFile' is not defined -- django

Erorr: name 'ContentFile' is not defined

NameError: name 'ContentFile' is not defined

Solution: Import the 'ContentFile' module

# Add the following line to the top of your code
from django.core.files.base import ContentFile

 

For more information:
django ContentFile