Traceback (most recent call last):
File "E:\python-movie-master\app\admin\forms.py", line 5, in
from app.models import Admin,Tag
File "E:\python-movie-master\app_init_.py", line 16, in
from app.admin import admin as admin_blueprint
File "E:\python-movie-master\app\admin_init_.py", line 6, in
import app.admin.views
File "E:\python-movie-master\app\admin\views.py", line 4, in
from app.admin.forms import LoginForm,TagForm,MovieForm,PreviewForm
File "E:\python-movie-master\app\admin\forms.py", line 6, in
tags = Tag.query.all()
File "E:\python-movie-master\venv\lib\site-packages\flask_sqlalchemy\model.py", line 31, in get
cls, session=cls.fsa.session() # type: ignore[arg-type]
File "E:\python-movie-master\venv\lib\site-packages\sqlalchemy\orm\scoping.py", line 217, in call
sess = self.registry()
File "E:\python-movie-master\venv\lib\site-packages\sqlalchemy\util_collections.py", line 640, in call
key = self.scopefunc()
File "E:\python-movie-master\venv\lib\site-packages\flask_sqlalchemy\session.py", line 102, in _app_ctx_id
return id(app_ctx._get_current_object()) # type: ignore[attr-defined]
File "E:\python-movie-master\venv\lib\site-packages\werkzeug\local.py", line 508, in _get_current_object
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
想问下这个是为什么,是代码哪里有问题吗
Traceback (most recent call last):
File "E:\python-movie-master\app\admin\forms.py", line 5, in
from app.models import Admin,Tag
File "E:\python-movie-master\app_init_.py", line 16, in
from app.admin import admin as admin_blueprint
File "E:\python-movie-master\app\admin_init_.py", line 6, in
import app.admin.views
File "E:\python-movie-master\app\admin\views.py", line 4, in
from app.admin.forms import LoginForm,TagForm,MovieForm,PreviewForm
File "E:\python-movie-master\app\admin\forms.py", line 6, in
tags = Tag.query.all()
File "E:\python-movie-master\venv\lib\site-packages\flask_sqlalchemy\model.py", line 31, in get
cls, session=cls.fsa.session() # type: ignore[arg-type]
File "E:\python-movie-master\venv\lib\site-packages\sqlalchemy\orm\scoping.py", line 217, in call
sess = self.registry()
File "E:\python-movie-master\venv\lib\site-packages\sqlalchemy\util_collections.py", line 640, in call
key = self.scopefunc()
File "E:\python-movie-master\venv\lib\site-packages\flask_sqlalchemy\session.py", line 102, in _app_ctx_id
return id(app_ctx._get_current_object()) # type: ignore[attr-defined]
File "E:\python-movie-master\venv\lib\site-packages\werkzeug\local.py", line 508, in _get_current_object
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
想问下这个是为什么,是代码哪里有问题吗