'Nonetype' object has no attribute 'cursor' : flask
www.reddit.com › r › flaskYou could either pass in the cursor as a parameter, initialize the cursor in the tcomment() function, or create a decorator to add the request context to tcomment. Those are just some ideas off the top of my head, but I would probably recommend having an instance of mysql.connection available in a module, and importing it as needed.