0

i am using SQLAlchemy python module to connect flask app with sqlite database(db browser for sqlite) but i dont know how to connect it. i have cloned a repo. Please tell me if i have to do any extra step or something. i have imported the .db file present in the repo to db browser but stuck here and getting this error

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.image_file AS user_image_file, user.password AS user_password
FROM user
WHERE user.username = ?
LIMIT ? OFFSET ?]
[parameters: ('21509016', 1, 0)]
(Background on this error at: https://sqlalche.me/e/20/e3q8)

please help me solve this error guys. you can view main.py code in github and help me i desperate to run this project!!!

i tried searching for the solution using gemini and chatgpt but it didn't gave up to the mark answers!

1 Answer 1

0

The error indicates that you need to create the database instances before running the app.

I am able to fix that and create new user and login the user by creating the tables before running the app in the run.py file:

from Main import app, db

if __name__ == '__main__':
    with app.app_context():
        db.create_all()   
    app.run(debug=True)

Demo:

running the app

Disclaimer: The project seems like a toy project and has a lot of bugs here and there (e.g. fixed dataset path).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.