Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flask.ext.script is deprecated

I have the following error:

web_1  | /code/app/__init__.py:4: ExtDeprecationWarning: Importing flask.ext.script is deprecated, use flask_script instead.
web_1  |   from flask.ext.script import Manager
web_1  | Traceback (most recent call last):
web_1  |   File "run.py", line 2, in <module>
web_1  |     from app import app
web_1  |   File "/code/app/__init__.py", line 4, in <module>
web_1  |     from flask.ext.script import Manager
web_1  |   File "/usr/local/lib/python3.6/site-packages/flask/exthook.py", line 110, in load_module
web_1  |     raise ImportError('No module named %s' % fullname)
web_1  | ImportError: No module named flask.ext.script

and then I made the change but then it says:

web_1  | Traceback (most recent call last):
web_1  |   File "run.py", line 2, in <module>
web_1  |     from app import app
web_1  |   File "/code/app/__init__.py", line 4, in <module>
web_1  |     from flask_script import Manager
web_1  | ModuleNotFoundError: No module named 'flask_script'

I'm a bit confused on how Flask was upgraded. Any advice? Should I fix my flask to an older version, maybe the dependencies aren't upgraded yet?

Using sqlalchemy and migrate:

from flask import Flask
from flask_ext.script import Manager
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.migrate import Migrate, MigrateCommand
like image 842
Tjorriemorrie Avatar asked Oct 02 '17 21:10

Tjorriemorrie


1 Answers

I had to explicitly install Flask-Script

Then the imports would work with

from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate, MigrateCommand
like image 155
Tjorriemorrie Avatar answered Nov 12 '22 12:11

Tjorriemorrie