flasky: Can't create db

Dear Miguel,

thanks you for your book,

I have some troubles, I am on chapter 8a.

I can’t create a db, db init, db downgrade etc - it’s ok, but when I start a server and add some text to form - I have this error:

sqlalchemy.exc.OperationalError

OperationalError: (OperationalError) no such table: users u'SELECT users.id AS users_id, users.username AS users_username, users.role_id AS users_role_id, users.password_hash AS users_password_hash \nFROM users \nWHERE users.username = ?\n LIMIT ? OFFSET ?' (u'dfh', 1, 0)

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 21 (5 by maintainers)

Most upvoted comments

git checkout 8a
rm data-dev.sqlite
python manage.py db upgrade
python manage.py runserver
OperationalError: (OperationalError) no such column: users.password_hash u'SELECT users.id AS users_id, users.username AS users_username, users.role_id AS users_role_id, users.password_hash AS users_password_hash \nFROM users \nWHERE users.username = ?\n LIMIT ? OFFSET ?' (u'Denis', 1, 0)

In flasky/migrations/versions I can see only initial migration, but you added new column to db (here and in next sections of chapter 8). Solution for me:

python manage.py db migrate
python manage.py db upgrade

@Morriaty-The-Murderer My guess is that the version of Flask-Migrate you have in your requirements.txt file does not match the version that is in your local virtualenv. Can you check?

@miguelgrinberg I specify the version, and it worked, thank you very much!