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

Solution: Import the 'CommandError' module

To Solve the error, add the following line to the top of your code.

from django import CommandError

 

For more information:
Python django CommandError