From another newbie, forgerypy and the subscription library3 are available for this purpose (although they look as if they werenβt affected a bit).
A simple example of using them by adding them to your model:
class TodoItem(db.Model): .... @staticmethod def generate_fake_data(records=10): import forgery_py from random import randint for record in records: todo = TodoItem(todo=forgery_py.lorem_ipsum.word(), due_date=forgery_py.date.date(), priority=randint(1,4)) db.session.add(todo) try: db.session.commit() except: db.session.rollback()
Then you call the generate_fake_data method in the shell session.
And Miguel Grinberg Flask Web Development (O'Reilly's book, not a blog), chapter 11, is a good resource for this.
source share