у меня есть такие модели User и Role:
# -*- coding: utf-8 -*-
from flask_admin.contrib.sqla import ModelView
from flask_security import UserMixin, RoleMixin
from flask_security.models import fsqla_v3 as fsqla
from hosting import db
class Roles(db.Model, fsqla.FsRoleMixin):
""" Класс описания ролей пользователя, нужен для дотсупа в админку """
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True)
description = db.Column(db.String(255))
class User(db.Model, fsqla.FsUserMixin):
""" Класс описывающий пользователя, нужен для доступа в админ-панель """
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True)
email = db.Column(db.String(255), unique=True)
password = db.Column(db.String(255))
active = db.Column(db.Boolean(), default=True)
roles = db.relationship('Role', secondary='user_roles', backref=db.backref('users', lazy='dynamic'))
class UserAdmin(ModelView):
""" Класс описывающий поведение User в админ панели """
column_list = ('id', 'username', 'email', 'password', 'active')
column_searchable_list = ('id', 'username', 'email')
column_filters = ('id', 'email', 'active')
form_columns = ('id', 'username', 'email', 'password', 'active')
user_roles = db.Table('user_roles',
db.Column('user_id', db.Integer(), db.ForeignKey('users.id')),
db.Column('role_id', db.Integer(), db.ForeignKey('roles.id'))
)
при попытке запуска приложения выдает ошибку библиотек:
Traceback (most recent call last):
File "/Users/lyaguxa/Projects/pics-hosting/manage.py", line 6, in <module>
from hosting import app
File "/Users/lyaguxa/Projects/pics-hosting/hosting/__init__.py", line 20, in <module>
from hosting import admin, route
File "/Users/lyaguxa/Projects/pics-hosting/hosting/admin.py", line 18, in <module>
from hosting.models import (TelegramUser, TelegramUserAdmin, Bot, BotAdmin, User, UserAdmin)
File "/Users/lyaguxa/Projects/pics-hosting/hosting/models/__init__.py", line 5, in <module>
from hosting.models.user import User, UserAdmin
File "/Users/lyaguxa/Projects/pics-hosting/hosting/models/user.py", line 5, in <module>
from flask_security import UserMixin, RoleMixin
File "/Users/lyaguxa/Library/Caches/pypoetry/virtualenvs/pics-hosting-hpxlJt8n-py3.11/lib/python3.11/site-packages/flask_security/__init__.py", line 14, in <module>
from .changeable import admin_change_password
File "/Users/lyaguxa/Library/Caches/pypoetry/virtualenvs/pics-hosting-hpxlJt8n-py3.11/lib/python3.11/site-packages/flask_security/changeable.py", line 15, in <module>
from flask_login import COOKIE_NAME as REMEMBER_COOKIE_NAME
File "/Users/lyaguxa/Library/Caches/pypoetry/virtualenvs/pics-hosting-hpxlJt8n-py3.11/lib/python3.11/site-packages/flask_login/__init__.py", line 12, in <module>
from .login_manager import LoginManager
File "/Users/lyaguxa/Library/Caches/pypoetry/virtualenvs/pics-hosting-hpxlJt8n-py3.11/lib/python3.11/site-packages/flask_login/login_manager.py", line 33, in <module>
from .utils import _create_identifier
File "/Users/lyaguxa/Library/Caches/pypoetry/virtualenvs/pics-hosting-hpxlJt8n-py3.11/lib/python3.11/site-packages/flask_login/utils.py", line 14, in <module>
from werkzeug.urls import url_decode
ImportError: cannot import name 'url_decode' from 'werkzeug.urls' (/Users/lyaguxa/Library/Caches/pypoetry/virtualenvs/pics-hosting-hpxlJt8n-py3.11/lib/python3.11/site-packages/werkzeug/urls.py)
Облазил все что можно, но не нашел как это исправить, в чем проблема?