title: sqlite3.OperationalError) no such table: user
body: <p>I am trying to create a simple website with Flask, and keep getting this error message sqlite3.OperationalError) no such table: user
  Tthe d.b is imported for every file, so I don't know where is the problem.
  this is the unfinished code. If any one can see what I need to fix please let me know.</p>
  <p><strong>init</strong>.py</p>
  <pre><code>from flask import Flask
  from flask_sqlalchemy import SQLAlchemy 
  from os import path
  
  
  db = SQLAlchemy()
  DB_NAME = &quot;database.db&quot;
  
  
  def create_app():
      app = Flask(__name__)
      app.config['SECRET_KEY'] = 'Loony Toons'
      app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}' 
      db.init_app(app)
  
      
      from .views import views
      from .auth import auth
  
      app.register_blueprint(views, url_prefix='/')
      app.register_blueprint(auth, url_prefix='/')
  
      from .models import User, Note
          
      create_database(app)
  
       
      return app
  
  
  def create_database(app):
      if not path.exists('website/' + DB_NAME):
         db.create_all(app=app)
         print('Created Database!') 
  
   
  </code></pre>
  <p>models.py</p>
  <pre><code>from . import db
  from flask_login import UserMixin
  from sqlalchemy.sql import func
  
  class User(db.Model, UserMixin):
      id = db.Column(db.Integer, primary_key=True)
      email = db.Column(db.String(150), unique=True)
      password = db.Column(db.String(150))
      first_name = db.Column(db.String(150))
      notes = db.relationship('Note')
  
  class Note(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      data = db.Column(db.String(10000))
      date = db.Column(db.DateTime(timezone=True), default=func.now())
      user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
  </code></pre>
  <p>auth.py</p>
  <pre><code>from flask import Blueprint, render_template, request, flash, redirect, url_for
  from .models import User
  from werkzeug.security import generate_password_hash
  from . import db
  
  
  auth = Blueprint('auth' ,__name__)
  
  @auth.route('/login', methods=['GET','POST'])
  def login():
      return render_template(&quot;login.html&quot;, boolean=True)
  
  @auth.route('/logout')
  def logout():
      return &quot;&lt;p&gt;Logout&lt;/p&gt;&quot;
  
  @auth.route('/sign-up', methods=['GET','POST'])
  def sign_up():
      if request.method == 'POST':
         email = request.form.get('email')
         first_name = request.form.get('firstName')
         password1 = request.form.get('password1')
         password2 = request.form.get('password2')
  
         
  
         if len(email) &lt; 4:
             flash('Email must be greater then 3 charecters', category='error')
             pass
         elif len(first_name)&lt;2:
             flash('First name must be greater then 1 charecters', category='error')
             pass
         elif password1 != password2:
              flash('Passwords dont match', category='error')
              pass
         elif len(password1) &lt; 7:
              flash('Password must be at least 7 characters', category='error')
              pass
         else:
             new_user = User(email=email, first_name=first_name, password=generate_password_hash(password1, method='sha256'))
             db.session.add(new_user)
             db.session.commit()
             flash('Account created!', category='success')
             return redirect(url_for('views.home'))
  
  
  
  
      return render_template(&quot;sign_up.html&quot;)
  </code></pre>