当前位置: 首页>>代码示例>>Python>>正文


Python RestAPI.setup方法代码示例

本文整理汇总了Python中flask_peewee.rest.RestAPI.setup方法的典型用法代码示例。如果您正苦于以下问题:Python RestAPI.setup方法的具体用法?Python RestAPI.setup怎么用?Python RestAPI.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_peewee.rest.RestAPI的用法示例。


在下文中一共展示了RestAPI.setup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_api

# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
def setup_api(auth):
    user_auth = UserAuthentication(auth)
    api = RestAPI(app, default_auth=user_auth)
    api.register(Note)
    api.register(Author)
    api.setup()
    return api
开发者ID:fspot,项目名称:flask-peewee-example,代码行数:9,代码来源:rest.py

示例2: initialize

# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
def initialize():
    global db, api

    db = Database(app)

    # Setup models
    import models
    models.setup()

    # Register REST api
    api = RestAPI(app)
    api.register(models.Flow)
    api.setup()
开发者ID:codito,项目名称:flow,代码行数:15,代码来源:flow.py

示例3: homepage

# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
api.register(Message, RestrictOwnerResource)
api.register(User, UserResource, auth=admin_auth)
api.register(Note)
api.register(TestModel, auth=api_key_auth)
api.register(AModel, AResource, auth=dummy_auth)
api.register(BModel, BResource, auth=dummy_auth)
api.register(CModel, CResource, auth=dummy_auth)

api.register(EModel, EResource, auth=dummy_auth)
api.register(FModel, FResource, auth=dummy_auth)


# views
@app.route('/')
def homepage():
    return Response()

@app.route('/private/')
@auth.login_required
def private_timeline():
    return Response()

@app.route('/secret/')
@auth.admin_required
def secret_area():
    return Response()


admin.setup()
api.setup()
开发者ID:dahool,项目名称:flask-peewee,代码行数:32,代码来源:test_app.py

示例4: ForeignKeyField

# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
	enfermeiro = ForeignKeyField(Enfermeiro, related_name='pacientes', null=True)
	sala = ForeignKeyField(Sala, related_name='pacientes', null=True)
	modeloAgendamento = ForeignKeyField(ModeloAgendamento, null=True)

class AvaliacaoEscalaBraden(db.Model):
	paciente = ForeignKeyField(Paciente, related_name='avaliacoes')
	sala = ForeignKeyField(Sala, related_name='avaliacoes')
	enfermeiro = ForeignKeyField(Enfermeiro, related_name='avaliacoes')
	data = DateTimeField();
	status = IntegerField()
	percepcaoSensorial = IntegerField()
	umidade = IntegerField()
	atividade = IntegerField()
	mobilidade = IntegerField()
	nutricao = IntegerField()
	friccao = IntegerField()

class Calendario(db.Model):
	dia = DateTimeField()

class CalendarioDetalhe(db.Model):
	calendario = ForeignKeyField(Calendario, related_name='detalhes')
	paciente = ForeignKeyField(Paciente)
	avaliacao = ForeignKeyField(AvaliacaoEscalaBraden, null=True)


restApi = RestAPI(app)
restApi.register(AvaliacaoEscalaBraden)
restApi.register(Sala)
restApi.setup()
开发者ID:victorfgasparin,项目名称:bradenScalePortalServer,代码行数:32,代码来源:models.py


注:本文中的flask_peewee.rest.RestAPI.setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。