我需要配置 Flask 应用程序来处理 HTTP 标头中任何主机的请求
如果在 SERVER_NAME 中指定了某些 fqdn,如果请求与任何其他域一起使用,则会出现 404 错误。SERVER_NAME 在配置中应该如何定义?
如何请求/路由/蓝图编辑 HTTP 主机名?
我需要从 Association_proxy 创建者/设置者访问父对象
class File(Base):
id = Column(INTEGER)
description = Column(String(1000))
content = Column(String(10000))
class User(Base):
name = Column(String(100))
cv_file_id = Column(INTEGER, ForeignKey(File.id))
cv_file = relationship(File, uselist=False)
cv = association_proxy('cv_file', None,
creator=lambda v: File(description = 'cv for ' + user.name, content = v),
...)
Run Code Online (Sandbox Code Playgroud)
我需要在创建者方法中引用用户对象,以便可以使用代理,如下所示
u = User(name = 'John')
u.cv = 'Some cv'
assert u.cv_file.description == 'cv for John'
Run Code Online (Sandbox Code Playgroud)