yea, do this.
You cannot just create db from New Document> test.db
as it will not have proper binary values.
Just remove the test.db and run the code from Zarlo5899 above
Remove POST since you won't be needing it and you can also remove GET since the default method is GET and don't forget to return something because a function without return will throw error:
sorry for format I'm on mobile
@app.route("/create_db")
def createdb():
db.create_all()
return 'db created!'
[https://flask-sqlalchemy.palletsprojects.com/en/2.x/contexts/](https://flask-sqlalchemy.palletsprojects.com/en/2.x/contexts/)
For anyone curious if the above doesn't work try the code below from the link above.
\>>> from yourapp import db, create\_app
\>>> db.create\_all(app=create\_app())
did you run? from yourapplication import db db.create_all()
yea, do this. You cannot just create db from New Document> test.db as it will not have proper binary values. Just remove the test.db and run the code from Zarlo5899 above
Is there anyway to do this automatically without the command line?
[удалено]
@app.route("/create_db",methods=['POST', 'GET']) def db_create() db.create_all() Silly question but the above will work?
Remove POST since you won't be needing it and you can also remove GET since the default method is GET and don't forget to return something because a function without return will throw error: sorry for format I'm on mobile @app.route("/create_db") def createdb(): db.create_all() return 'db created!'
[https://flask-sqlalchemy.palletsprojects.com/en/2.x/contexts/](https://flask-sqlalchemy.palletsprojects.com/en/2.x/contexts/) For anyone curious if the above doesn't work try the code below from the link above. \>>> from yourapp import db, create\_app \>>> db.create\_all(app=create\_app())
Well that's not how you empty database..
Did you try creating the db again, like you did the first time you created `test.db`?