#Sora#peewee plus celery = ?
最近疯看全职猎人 初步学习了peewee,因为sqlalchemy实在是太重量级,文档也太恶心,peewee上手容易得多,也非常light 结合celery和peewee,写了点东西,查询年龄 myapp/db.py: from __future__ import absolute_import from myapp.celery import app from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() age = IntegerField() class Meta: database = db @app.task def agequery(name): db.connect() # collection = [] for i in Person.select().where(Person.name == name): return {'name':name,'age':i.age} # collection.append({'name':name,'age':i.age}) # return collection db.close() @app.task def savedata(message): db.connect() newdata =