Search code examples
pythonflaskpeeweeflask-peewee

Replace flask_peewee.db with plain peewee module?


I have a flask app that's using flask_peewee.db in it's app module:

from flask_peewee.db import Database

Is it possible to replace the flask_peewee Database module with a plain peewee module? The author of flask_peewee says it's in maintenance mode and while not exactly sunset, I'm reluctant to start a new project using it. Unfortunately, I love the flask/peewee combo and it appears flask_peewee may be the only way to bind the two together without heartache. Ideas?


Solution

  • You can try out the FlaskDB object in playhouse.flask_utils:

    http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#database-wrapper

    While not 100% the same, I think that might work well for you.