I encountered a problem when I used flask_sqlalchemy
for the first time, as follows
uses python
version 3.6
, uses conda
as the package manager, and has successfully installed flask_sqlalchemy
and other related dependent packages.
the simple directory of the project is as follows:
app.py
db/
models/
__init__.py
todo.py
routes/
__init__.py
todo.py
static/
templates/
app.py
the contents of the file are as follows:
>>> from app import db
>>> db.create_all()
problems are as follows:
check the file directory at this time and find that there is a data.sqlite
file under models/
, but there is no content in the file, the display size is 0 byte
, and I use database management software to check and find that there is no data in any table. At the same time, if I continue to execute db.drop_all
, I cannot delete the database file.
I would like to ask how to solve this situation. I Googled it and couldn"t find the answer. I hope I can get some advice from my predecessors. I would appreciate it.