我想在 theme.py 里引入 theme_product
使用 from . import theme_product 就可以
使用 from .theme_product import Theme_Product
就提示 cannot import name 'Theme_Product'
大写的 Theme_product 是 theme_product 的中的数据库类
--------分隔线---------
product,theme,是多对多关系,theme_product 是中间表
from . import theme_product
theme=db.relationship('Theme_Product',
foreign_keys=[theme_product.Theme_Product.product_id],
backref=db.backref('backProduct',lazy='joined'),
lazy='dynamic',
cascade='all,delete-orphan')
foreign_keys 那里告诉我 theme_product 没有 Theme_Product,这个 attribute
应该如何处理呢?
你可以试试这样
如果这个还不行,试试这个