您好,我有一些外键问题。
我有这样的事情:
class Foo(db.Model):
"""The foo object."""
__tablename__ = 'foos_foo'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.Text, unique=True)
content = db.Column(db.Text)
bar = db.relationship('Bar', backref='bars_bar')
bar_id = db.Column(db.Integer, db.ForeignKey('bars_bar.id'))
class Bar(db.Model):
"""The bar object."""
__tablename__ = 'bars_bar'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Text, unique=True)
description = db.Column(db.Text)
status = db.Column(db.SmallInteger, default=NEW)
Run Code Online (Sandbox Code Playgroud)
我使用这种配置风格:https : //github.com/mitsuhiko/flask/wiki/Large-app-how-to
所以我有这样的事情:
from app.foos.views import mod as foosModule
from app.bars.views import mod as barsModule
app.register_blueprint(foosModule)
app.register_blueprint(barsModule)
Run Code Online (Sandbox Code Playgroud)
If I call like in the config style from …