为什么我的烧瓶RESTplus型号未注册

时间:2020-10-20 05:32:21

标签: python api flask swagger-ui flask-restplus

我有一个Flask RESTplus代码,在其中实例化了“ models.py”文件夹中的模型。 我在各自的Flask SQLAlchemy模型类中命名了所有API模型

例如

class User(db.Model):
   serializer = api.model("user", {
      "name" : fields.String,
   })
   name = db.Column(db.String(10))

class Profile(db.Model):
   serializer = api.model("profile",{
      "country": fields.String,
   })
   country = db.Column(db.String(50))

使用Flask应用程序工厂方法和API的名称空间,像每个模型一样。 我的问题是,Swagger UI中仅显示一种模型,我很困惑。 我已尽一切努力使其他人显示,但没有任何效果

该代码位于Heroku上,因此您可以在其中看到Swagger UI

https://restplus-music-review.herokuapp.com/

1 个答案:

答案 0 :(得分:0)

自己解决。 问题出在我身上,没有在任何方法上使用model装饰器。但是我碰巧在响应装饰器上使用了*{ margin:0; padding:0; } .example{ height: 200px; width: 500px; border: 3px solid black; position: relative; } .hover{ position: absolute; opacity: 0; top: 0; left: 0; height: 100%; width: 100%; background-image: linear-gradient(to right, rgba(128,128,128, 0.8), rgba(0,0,0, 0.8)); transition: all 1s; z-index: 8; } .hover:hover { opacity: 100; } .hover:hover h2{ opacity: 100; } .hover:hover + #white{ opacity: 0; } h2 { transition: all 1s; opacity: 0; color: white; } #white{ position: absolute; top: 0; left: 0; height: 200px; width: 500px; background-color:rgba(255, 255, 255, 0.6); opacity: 100; transition: all 1s; z-index: 4; } h1{ position: absolute; top: 50%; /* these lines centers text*/ left: 50%; transform: translate(-50%, -50%); }参数。导致记录了一个模型,而没有记录其他模型。谢谢