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

Solution: Import the 'logout' module

# Add the following line to the top of your code
from django.contrib.auth import logout

 

For more information:
django logout