TaleLin / lin-cms-flask

🎀A simple and practical CMS implememted by Flask
http://doc.cms.talelin.com/
Other
832 stars 216 forks source link

flask db init 出现问题 #138

Closed LRboyz closed 3 years ago

LRboyz commented 3 years ago

具体报错如下, 可以生成db文件,但是表里面没有数据 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.8/bin/flask", line 8, in sys.exit(main()) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/cli.py", line 967, in main cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/cli.py", line 586, in main return super(FlaskGroup, self).main(args, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(args, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func return f(get_current_context(), *args, *kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/cli.py", line 426, in decorator return __ctx.invoke(f, args, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, *kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask_migrate/cli.py", line 31, in init _init(directory, multidb) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask_migrate/init.py", line 95, in wrapped f(args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask_migrate/init.py", line 125, in init directory = current_app.extensions['migrate'].directory KeyError: 'migrate'

如何解决呢

sunlin92 commented 3 years ago

flask db init 在Lin-cms-flask项目中是由flask cli定义的,与flask-migrate自带的命令冲突 如果一定要使用这个依赖,可以在app/cli/db/init.py中变更脚本执行指令。