How to Solve NameError: name 'db' is not defined -- replit

Solution: Import the 'db' module

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

from replit import db

 

For more information:
Python replit db