From yesterday I read a lot of topics about the famous error:
"No such command init-db"
So, I followed the tutorial here: https://flask.palletsprojects.com/en/1.1.x/tutorial/database/
(I'm under Debian 9.6)
I do the following :
export FLASK_APP=webApp
export FLASK_ENV=development
flask init-db
I then tried:
python3 -m flask init-db
I also tried:
export FLASK_APP=webApp.py
But I still have the same error message.
Here is the tree of my project :
instance/
webApp/
├── auth.py
├── babel.cfg
├── dashboard.py
├── db.py
├── __init__.py
├── pdf.py
├── __pycache__
│ ├── auth.cpython-35.pyc
│ ├── db.cpython-35.pyc
│ ├── __init__.cpython-35.pyc
│ ├── pdf.cpython-35.pyc
│ └── ws.cpython-35.pyc
├── schema.sql
├── static
I didn't see what I've missed.
Initialize the Database File Run the init-db command: $ flask --app flaskr init-db Initialized the database. There will now be a flaskr. sqlite file in the instance folder in your project.
To first set up your migrations directory, we can run flask db init . This creates a new migration repository; in so doing, this command creates a couple of folders and files in our project root where our migrations will live. We only need to do this once.
I found the problem.
When I launched flask --help
, I saw there was an import error of a module. I just installed that module via pip
, and it was okay.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With