Database Problem sqlite3.Operational Error for Flask










1














Hey I am having trouble with this little project I am doing.



Basically, I am trying to structure a therapist and his patients. I have two models of the database, therapist and patient. Therapist signs up or logs-in, I have both a registration Form and a Login Form for the therapist.



After therapist successfully logs in or registers, it is led to the home page where he can click a link to register patients. I have already set a patientregistrationform as well.



I am having trouble with two things.



On my project once I run it, and I put in fields on the registration form to create a user/therapist, I get an error. I believe it is an error in the model class, but I can't figure out why.



I just started doing this a week ago, so, I really would appreciate it if someone could help me with this.



  • sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user [SQL: 'SELECT user.id AS user_id, user.username AS user_username, user.email AS user_email, user.password_hash AS user_password_hash nFROM user nWHERE user.username = ?n LIMIT ? OFFSET ?'] [parameters: ('yohannes', 1, 0)] (Background on this error at: http://sqlalche.me/e/e3q8)

This is my models file



from app import db, login
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash

class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(64), index=True, unique=True)
email = db.Column(db.String(120), index=True, unique=True)
password_hash = db.Column(db.String(128))
patients = db.relationship('Patient', backref='author', lazy='dynamic')

def __repr__(self):
return '<User >'.format(self.username)

def set_password(self, password):
self.password_hash = generate_password_hash(password)

def check_password(self, password):
return check_password_hash(self.password_hash, password)


@login.user_loader
def load_user(id):
return User.query.get(int(id))

class Patient(db.Model):
id = db.Column(db.Integer, primary_key=True)
firstname = db.Column(db.String(64))
lastname = db.Column(db.String(64))
dateofbirth = db.Column(db.String(32))
typeoftherapy = db.Column(db.String(64))
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

def __repr__(self):
return '<Patient >'.format(self.firstname)


and this is my forms file



from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField
from wtforms.validators import ValidationError, DataRequired, EqualTo, Email
from app.models import User, Patient

class PatientSignUpForm(FlaskForm):
firstname = StringField('First Name', validators=[DataRequired()])
lastname = StringField('Last Name', validators=[DataRequired()])
dateofbirth = StringField('Date of Birth', validators=[DataRequired()])
typeoftherapy = StringField('Type of Therapy', validators=[DataRequired()])
submit = SubmitField('Sign Up Patient')

class TherapistLoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
remember_me = BooleanField('Remember Me')
submit = SubmitField('Sign In')

class TherapistRegistrationForm(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
email = StringField('Email', validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
password2 = PasswordField(
'Repeat Password', validators=[DataRequired(), EqualTo('password')])
submit = SubmitField('Register')

def validate_username(self, username):
user = User.query.filter_by(username=username.data).first()
if user is not None:
raise ValidationError('Please use a different username.')

def validate_email(self, email):
user = User.query.filter_by(email=email.data).first()
if user is not None:
raise ValidationError('Please use a different email address.')


This is my routes file



from flask import render_template, flash, redirect, url_for, request
from flask_login import login_user, logout_user, current_user, login_required
from werkzeug.urls import url_parse
from app import app, db
from app.forms import PatientSignUpForm, TherapistLoginForm, TherapistRegistrationForm
from app.models import Patient, User

@app.route('/')
@app.route('/index')
@login_required

def index():
patients = [

'doctor': 'username': 'Yohannes',
'treatment': 'Physical Therapy'
,

'doctor': 'username': 'Henok',
'treatment': 'Mental Therapy'


]
return render_template('index.html', title ='Home', user=user, patients=patients)

@app.route('/patients')

def patients():
patient = Patient.query.filter_by(firstname=firstname).all()
patients = [
'Patient': patient, 'Patient': patient
]
return render_template('base.html', patient=patient)


@app.route('/signup', methods=['GET', 'POST'])
def login():
if current_user.is_authenticated:
return redirect(url_for('index'))
form = TherapistLoginForm()
if form.validate_on_submit():
user = Therapist.query.filter_by(username=form.username.data).first()
if user is None or not Therapist.check_password(form.password.data):
flash('Invalid username or password')
return redirect(url_for('login'))
login_user(user, remember=form.remember_me.data)
next_page = request.args.get('next')
if not next_page or url_parse(next_page).netloc != '':
next_page = url_for('index')
return redirect(next_page)
return render_template('login.html', title='Sign In', form=form)

@app.route('/logout')
def logout():
logout_user()
return redirect(url_for('index'))

@app.route('/register', methods=['GET', 'POST'])
def register():
if current_user.is_authenticated:
return redirect(url_for('index'))
form = TherapistRegistrationForm()
if form.validate_on_submit():
user = User(username=form.username.data, email=form.email.data)
user.set_password(form.password.data)
db.session.add(user)
db.session.commit()
flash('Congratulations, you are now a registered user!')
return redirect(url_for('login'))
return render_template('register.html', title='Register', form=form)









share|improve this question




























    1














    Hey I am having trouble with this little project I am doing.



    Basically, I am trying to structure a therapist and his patients. I have two models of the database, therapist and patient. Therapist signs up or logs-in, I have both a registration Form and a Login Form for the therapist.



    After therapist successfully logs in or registers, it is led to the home page where he can click a link to register patients. I have already set a patientregistrationform as well.



    I am having trouble with two things.



    On my project once I run it, and I put in fields on the registration form to create a user/therapist, I get an error. I believe it is an error in the model class, but I can't figure out why.



    I just started doing this a week ago, so, I really would appreciate it if someone could help me with this.



    • sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user [SQL: 'SELECT user.id AS user_id, user.username AS user_username, user.email AS user_email, user.password_hash AS user_password_hash nFROM user nWHERE user.username = ?n LIMIT ? OFFSET ?'] [parameters: ('yohannes', 1, 0)] (Background on this error at: http://sqlalche.me/e/e3q8)

    This is my models file



    from app import db, login
    from flask_login import UserMixin
    from werkzeug.security import generate_password_hash, check_password_hash

    class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), index=True, unique=True)
    email = db.Column(db.String(120), index=True, unique=True)
    password_hash = db.Column(db.String(128))
    patients = db.relationship('Patient', backref='author', lazy='dynamic')

    def __repr__(self):
    return '<User >'.format(self.username)

    def set_password(self, password):
    self.password_hash = generate_password_hash(password)

    def check_password(self, password):
    return check_password_hash(self.password_hash, password)


    @login.user_loader
    def load_user(id):
    return User.query.get(int(id))

    class Patient(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    firstname = db.Column(db.String(64))
    lastname = db.Column(db.String(64))
    dateofbirth = db.Column(db.String(32))
    typeoftherapy = db.Column(db.String(64))
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

    def __repr__(self):
    return '<Patient >'.format(self.firstname)


    and this is my forms file



    from flask_wtf import FlaskForm
    from wtforms import StringField, PasswordField, BooleanField, SubmitField
    from wtforms.validators import ValidationError, DataRequired, EqualTo, Email
    from app.models import User, Patient

    class PatientSignUpForm(FlaskForm):
    firstname = StringField('First Name', validators=[DataRequired()])
    lastname = StringField('Last Name', validators=[DataRequired()])
    dateofbirth = StringField('Date of Birth', validators=[DataRequired()])
    typeoftherapy = StringField('Type of Therapy', validators=[DataRequired()])
    submit = SubmitField('Sign Up Patient')

    class TherapistLoginForm(FlaskForm):
    username = StringField('Username', validators=[DataRequired()])
    password = PasswordField('Password', validators=[DataRequired()])
    remember_me = BooleanField('Remember Me')
    submit = SubmitField('Sign In')

    class TherapistRegistrationForm(FlaskForm):
    username = StringField('Username', validators=[DataRequired()])
    email = StringField('Email', validators=[DataRequired(), Email()])
    password = PasswordField('Password', validators=[DataRequired()])
    password2 = PasswordField(
    'Repeat Password', validators=[DataRequired(), EqualTo('password')])
    submit = SubmitField('Register')

    def validate_username(self, username):
    user = User.query.filter_by(username=username.data).first()
    if user is not None:
    raise ValidationError('Please use a different username.')

    def validate_email(self, email):
    user = User.query.filter_by(email=email.data).first()
    if user is not None:
    raise ValidationError('Please use a different email address.')


    This is my routes file



    from flask import render_template, flash, redirect, url_for, request
    from flask_login import login_user, logout_user, current_user, login_required
    from werkzeug.urls import url_parse
    from app import app, db
    from app.forms import PatientSignUpForm, TherapistLoginForm, TherapistRegistrationForm
    from app.models import Patient, User

    @app.route('/')
    @app.route('/index')
    @login_required

    def index():
    patients = [

    'doctor': 'username': 'Yohannes',
    'treatment': 'Physical Therapy'
    ,

    'doctor': 'username': 'Henok',
    'treatment': 'Mental Therapy'


    ]
    return render_template('index.html', title ='Home', user=user, patients=patients)

    @app.route('/patients')

    def patients():
    patient = Patient.query.filter_by(firstname=firstname).all()
    patients = [
    'Patient': patient, 'Patient': patient
    ]
    return render_template('base.html', patient=patient)


    @app.route('/signup', methods=['GET', 'POST'])
    def login():
    if current_user.is_authenticated:
    return redirect(url_for('index'))
    form = TherapistLoginForm()
    if form.validate_on_submit():
    user = Therapist.query.filter_by(username=form.username.data).first()
    if user is None or not Therapist.check_password(form.password.data):
    flash('Invalid username or password')
    return redirect(url_for('login'))
    login_user(user, remember=form.remember_me.data)
    next_page = request.args.get('next')
    if not next_page or url_parse(next_page).netloc != '':
    next_page = url_for('index')
    return redirect(next_page)
    return render_template('login.html', title='Sign In', form=form)

    @app.route('/logout')
    def logout():
    logout_user()
    return redirect(url_for('index'))

    @app.route('/register', methods=['GET', 'POST'])
    def register():
    if current_user.is_authenticated:
    return redirect(url_for('index'))
    form = TherapistRegistrationForm()
    if form.validate_on_submit():
    user = User(username=form.username.data, email=form.email.data)
    user.set_password(form.password.data)
    db.session.add(user)
    db.session.commit()
    flash('Congratulations, you are now a registered user!')
    return redirect(url_for('login'))
    return render_template('register.html', title='Register', form=form)









    share|improve this question


























      1












      1








      1







      Hey I am having trouble with this little project I am doing.



      Basically, I am trying to structure a therapist and his patients. I have two models of the database, therapist and patient. Therapist signs up or logs-in, I have both a registration Form and a Login Form for the therapist.



      After therapist successfully logs in or registers, it is led to the home page where he can click a link to register patients. I have already set a patientregistrationform as well.



      I am having trouble with two things.



      On my project once I run it, and I put in fields on the registration form to create a user/therapist, I get an error. I believe it is an error in the model class, but I can't figure out why.



      I just started doing this a week ago, so, I really would appreciate it if someone could help me with this.



      • sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user [SQL: 'SELECT user.id AS user_id, user.username AS user_username, user.email AS user_email, user.password_hash AS user_password_hash nFROM user nWHERE user.username = ?n LIMIT ? OFFSET ?'] [parameters: ('yohannes', 1, 0)] (Background on this error at: http://sqlalche.me/e/e3q8)

      This is my models file



      from app import db, login
      from flask_login import UserMixin
      from werkzeug.security import generate_password_hash, check_password_hash

      class User(UserMixin, db.Model):
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(64), index=True, unique=True)
      email = db.Column(db.String(120), index=True, unique=True)
      password_hash = db.Column(db.String(128))
      patients = db.relationship('Patient', backref='author', lazy='dynamic')

      def __repr__(self):
      return '<User >'.format(self.username)

      def set_password(self, password):
      self.password_hash = generate_password_hash(password)

      def check_password(self, password):
      return check_password_hash(self.password_hash, password)


      @login.user_loader
      def load_user(id):
      return User.query.get(int(id))

      class Patient(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      firstname = db.Column(db.String(64))
      lastname = db.Column(db.String(64))
      dateofbirth = db.Column(db.String(32))
      typeoftherapy = db.Column(db.String(64))
      user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

      def __repr__(self):
      return '<Patient >'.format(self.firstname)


      and this is my forms file



      from flask_wtf import FlaskForm
      from wtforms import StringField, PasswordField, BooleanField, SubmitField
      from wtforms.validators import ValidationError, DataRequired, EqualTo, Email
      from app.models import User, Patient

      class PatientSignUpForm(FlaskForm):
      firstname = StringField('First Name', validators=[DataRequired()])
      lastname = StringField('Last Name', validators=[DataRequired()])
      dateofbirth = StringField('Date of Birth', validators=[DataRequired()])
      typeoftherapy = StringField('Type of Therapy', validators=[DataRequired()])
      submit = SubmitField('Sign Up Patient')

      class TherapistLoginForm(FlaskForm):
      username = StringField('Username', validators=[DataRequired()])
      password = PasswordField('Password', validators=[DataRequired()])
      remember_me = BooleanField('Remember Me')
      submit = SubmitField('Sign In')

      class TherapistRegistrationForm(FlaskForm):
      username = StringField('Username', validators=[DataRequired()])
      email = StringField('Email', validators=[DataRequired(), Email()])
      password = PasswordField('Password', validators=[DataRequired()])
      password2 = PasswordField(
      'Repeat Password', validators=[DataRequired(), EqualTo('password')])
      submit = SubmitField('Register')

      def validate_username(self, username):
      user = User.query.filter_by(username=username.data).first()
      if user is not None:
      raise ValidationError('Please use a different username.')

      def validate_email(self, email):
      user = User.query.filter_by(email=email.data).first()
      if user is not None:
      raise ValidationError('Please use a different email address.')


      This is my routes file



      from flask import render_template, flash, redirect, url_for, request
      from flask_login import login_user, logout_user, current_user, login_required
      from werkzeug.urls import url_parse
      from app import app, db
      from app.forms import PatientSignUpForm, TherapistLoginForm, TherapistRegistrationForm
      from app.models import Patient, User

      @app.route('/')
      @app.route('/index')
      @login_required

      def index():
      patients = [

      'doctor': 'username': 'Yohannes',
      'treatment': 'Physical Therapy'
      ,

      'doctor': 'username': 'Henok',
      'treatment': 'Mental Therapy'


      ]
      return render_template('index.html', title ='Home', user=user, patients=patients)

      @app.route('/patients')

      def patients():
      patient = Patient.query.filter_by(firstname=firstname).all()
      patients = [
      'Patient': patient, 'Patient': patient
      ]
      return render_template('base.html', patient=patient)


      @app.route('/signup', methods=['GET', 'POST'])
      def login():
      if current_user.is_authenticated:
      return redirect(url_for('index'))
      form = TherapistLoginForm()
      if form.validate_on_submit():
      user = Therapist.query.filter_by(username=form.username.data).first()
      if user is None or not Therapist.check_password(form.password.data):
      flash('Invalid username or password')
      return redirect(url_for('login'))
      login_user(user, remember=form.remember_me.data)
      next_page = request.args.get('next')
      if not next_page or url_parse(next_page).netloc != '':
      next_page = url_for('index')
      return redirect(next_page)
      return render_template('login.html', title='Sign In', form=form)

      @app.route('/logout')
      def logout():
      logout_user()
      return redirect(url_for('index'))

      @app.route('/register', methods=['GET', 'POST'])
      def register():
      if current_user.is_authenticated:
      return redirect(url_for('index'))
      form = TherapistRegistrationForm()
      if form.validate_on_submit():
      user = User(username=form.username.data, email=form.email.data)
      user.set_password(form.password.data)
      db.session.add(user)
      db.session.commit()
      flash('Congratulations, you are now a registered user!')
      return redirect(url_for('login'))
      return render_template('register.html', title='Register', form=form)









      share|improve this question















      Hey I am having trouble with this little project I am doing.



      Basically, I am trying to structure a therapist and his patients. I have two models of the database, therapist and patient. Therapist signs up or logs-in, I have both a registration Form and a Login Form for the therapist.



      After therapist successfully logs in or registers, it is led to the home page where he can click a link to register patients. I have already set a patientregistrationform as well.



      I am having trouble with two things.



      On my project once I run it, and I put in fields on the registration form to create a user/therapist, I get an error. I believe it is an error in the model class, but I can't figure out why.



      I just started doing this a week ago, so, I really would appreciate it if someone could help me with this.



      • sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: user [SQL: 'SELECT user.id AS user_id, user.username AS user_username, user.email AS user_email, user.password_hash AS user_password_hash nFROM user nWHERE user.username = ?n LIMIT ? OFFSET ?'] [parameters: ('yohannes', 1, 0)] (Background on this error at: http://sqlalche.me/e/e3q8)

      This is my models file



      from app import db, login
      from flask_login import UserMixin
      from werkzeug.security import generate_password_hash, check_password_hash

      class User(UserMixin, db.Model):
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(64), index=True, unique=True)
      email = db.Column(db.String(120), index=True, unique=True)
      password_hash = db.Column(db.String(128))
      patients = db.relationship('Patient', backref='author', lazy='dynamic')

      def __repr__(self):
      return '<User >'.format(self.username)

      def set_password(self, password):
      self.password_hash = generate_password_hash(password)

      def check_password(self, password):
      return check_password_hash(self.password_hash, password)


      @login.user_loader
      def load_user(id):
      return User.query.get(int(id))

      class Patient(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      firstname = db.Column(db.String(64))
      lastname = db.Column(db.String(64))
      dateofbirth = db.Column(db.String(32))
      typeoftherapy = db.Column(db.String(64))
      user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

      def __repr__(self):
      return '<Patient >'.format(self.firstname)


      and this is my forms file



      from flask_wtf import FlaskForm
      from wtforms import StringField, PasswordField, BooleanField, SubmitField
      from wtforms.validators import ValidationError, DataRequired, EqualTo, Email
      from app.models import User, Patient

      class PatientSignUpForm(FlaskForm):
      firstname = StringField('First Name', validators=[DataRequired()])
      lastname = StringField('Last Name', validators=[DataRequired()])
      dateofbirth = StringField('Date of Birth', validators=[DataRequired()])
      typeoftherapy = StringField('Type of Therapy', validators=[DataRequired()])
      submit = SubmitField('Sign Up Patient')

      class TherapistLoginForm(FlaskForm):
      username = StringField('Username', validators=[DataRequired()])
      password = PasswordField('Password', validators=[DataRequired()])
      remember_me = BooleanField('Remember Me')
      submit = SubmitField('Sign In')

      class TherapistRegistrationForm(FlaskForm):
      username = StringField('Username', validators=[DataRequired()])
      email = StringField('Email', validators=[DataRequired(), Email()])
      password = PasswordField('Password', validators=[DataRequired()])
      password2 = PasswordField(
      'Repeat Password', validators=[DataRequired(), EqualTo('password')])
      submit = SubmitField('Register')

      def validate_username(self, username):
      user = User.query.filter_by(username=username.data).first()
      if user is not None:
      raise ValidationError('Please use a different username.')

      def validate_email(self, email):
      user = User.query.filter_by(email=email.data).first()
      if user is not None:
      raise ValidationError('Please use a different email address.')


      This is my routes file



      from flask import render_template, flash, redirect, url_for, request
      from flask_login import login_user, logout_user, current_user, login_required
      from werkzeug.urls import url_parse
      from app import app, db
      from app.forms import PatientSignUpForm, TherapistLoginForm, TherapistRegistrationForm
      from app.models import Patient, User

      @app.route('/')
      @app.route('/index')
      @login_required

      def index():
      patients = [

      'doctor': 'username': 'Yohannes',
      'treatment': 'Physical Therapy'
      ,

      'doctor': 'username': 'Henok',
      'treatment': 'Mental Therapy'


      ]
      return render_template('index.html', title ='Home', user=user, patients=patients)

      @app.route('/patients')

      def patients():
      patient = Patient.query.filter_by(firstname=firstname).all()
      patients = [
      'Patient': patient, 'Patient': patient
      ]
      return render_template('base.html', patient=patient)


      @app.route('/signup', methods=['GET', 'POST'])
      def login():
      if current_user.is_authenticated:
      return redirect(url_for('index'))
      form = TherapistLoginForm()
      if form.validate_on_submit():
      user = Therapist.query.filter_by(username=form.username.data).first()
      if user is None or not Therapist.check_password(form.password.data):
      flash('Invalid username or password')
      return redirect(url_for('login'))
      login_user(user, remember=form.remember_me.data)
      next_page = request.args.get('next')
      if not next_page or url_parse(next_page).netloc != '':
      next_page = url_for('index')
      return redirect(next_page)
      return render_template('login.html', title='Sign In', form=form)

      @app.route('/logout')
      def logout():
      logout_user()
      return redirect(url_for('index'))

      @app.route('/register', methods=['GET', 'POST'])
      def register():
      if current_user.is_authenticated:
      return redirect(url_for('index'))
      form = TherapistRegistrationForm()
      if form.validate_on_submit():
      user = User(username=form.username.data, email=form.email.data)
      user.set_password(form.password.data)
      db.session.add(user)
      db.session.commit()
      flash('Congratulations, you are now a registered user!')
      return redirect(url_for('login'))
      return render_template('register.html', title='Register', form=form)






      python database sqlite flask sqlite3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 1:52









      Jack Herer

      338112




      338112










      asked Nov 11 '18 at 22:07









      YANZ

      94




      94






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The error from sqlite3 is very good, it tells you no such table: user which means exactly what it says - there is no table in your database called user. Have you initialised your database? Do you have a database file?



          I suggest you use Flask-Migrate for your database init and migrations.






          share|improve this answer




















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253730%2fdatabase-problem-sqlite3-operational-error-for-flask%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            The error from sqlite3 is very good, it tells you no such table: user which means exactly what it says - there is no table in your database called user. Have you initialised your database? Do you have a database file?



            I suggest you use Flask-Migrate for your database init and migrations.






            share|improve this answer

























              0














              The error from sqlite3 is very good, it tells you no such table: user which means exactly what it says - there is no table in your database called user. Have you initialised your database? Do you have a database file?



              I suggest you use Flask-Migrate for your database init and migrations.






              share|improve this answer























                0












                0








                0






                The error from sqlite3 is very good, it tells you no such table: user which means exactly what it says - there is no table in your database called user. Have you initialised your database? Do you have a database file?



                I suggest you use Flask-Migrate for your database init and migrations.






                share|improve this answer












                The error from sqlite3 is very good, it tells you no such table: user which means exactly what it says - there is no table in your database called user. Have you initialised your database? Do you have a database file?



                I suggest you use Flask-Migrate for your database init and migrations.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 12 '18 at 1:42









                Jack Herer

                338112




                338112



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253730%2fdatabase-problem-sqlite3-operational-error-for-flask%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo