If I remove the -m flag I get an module not found error
$ flask db migrate
Traceback (most recent call last):
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/bin/alembic", line 8, in
sys.exit(main())
^^^^^^
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/config.py", line 636, in main
CommandLine(prog=prog).main(argv=argv)
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/config.py", line 626, in main
self.run_cmd(cfg, options)
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/config.py", line 603, in run_cmd
fn(
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/command.py", line 406, in upgrade
script.run_env()
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/script/base.py", line 582, in run_env
util.load_python_file(self.dir, "env.py")
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/johndoe/.local/share/virtualenvs/microblog-IrJMmESS/lib/python3.12/site-packages/alembic/util/pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in _call_with_frames_removed
File "/Users/johndoe/Code/microblog/db/env.py", line 7, in
from app import create_app
ModuleNotFoundError: No module named 'app'
I discovered this when adapting the tutorial to my own situation so to confirm if it was me or not, I checked out tag 0.3 from the github repo and followed Chapter 4 up to running ''flask db migrate;
It's also worth pointing out that 'flask db init' also provides different output from the tutorial.
$ flask db init
alembic.ini was created in the root of your project
db/ was created with your Alembic configs, versions/ directory and seeds.py
Versions of things
Python 3.12
alembic==1.13.2
flask-db==0.4.1
flask-migrate==4.0.7
These are slightly different to what's in requirements.txt in the repo. I can't compare versions for flask-db as it's not listed there.
Two issues occur when running 'flask db migrate'
I discovered this when adapting the tutorial to my own situation so to confirm if it was me or not, I checked out tag 0.3 from the github repo and followed Chapter 4 up to running ''flask db migrate;
It's also worth pointing out that 'flask db init' also provides different output from the tutorial.
Versions of things
These are slightly different to what's in requirements.txt in the repo. I can't compare versions for flask-db as it's not listed there.