title: Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'db' is not defined
body: <p>'''
  import db.py
  from flask import Flask, render_template
  from flask_sqlalchemy import SQLAlchemy
  from datetime import datetime</p>
  <pre><code>app =Flask(__name__)
  app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///posts.db'
  
  
  class Question(db.model):
       id = db.Column(db.Integer, primary_key=True)
       title  = db.Column(db.String(100), nullable=False)
       content = db.Column(db,Text, nullable=False)
       Date_Posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
  
       def __repr__(self):
           return 'Question' + str(self.id)
  
  
  @app.route('/mainpage' , methods = ['GET'])
  def mainpage():
      return render_template(&quot;main.html&quot;)
  
  @app.route('/askdaiwik')
  def ask():
      return render_template(&quot;ask.html&quot; , ask = all_ask)
  
  if __name__ == &quot;__main__&quot;:
      app.run(debug=True)
  </code></pre>
  <p>'''</p>