Closed ajesh-pb-ai closed 3 years ago
If I comment the line db.session.commit()
in the package, Able to load the seeds succesfully.
Flask-Seeder expects a db object with an SQLAlchemy session attribute to be able to commit any changes. db
is typically an instance of Flask-SQLAlchemy which is what Flask-Seeder has been tested for and known to support. I'm not familiar with MongoEngine so I'm afraid I can't help you very much here but if you have a working solution for it that doesn't break existing functionality you're welcome to submit a PR.
Code, I have used
from flask import Flask
from flask_mongoengine import MongoEngine
app = Flask(__name__)
db = MongoEngine()
db.init_app(app)
seeder = FlaskSeeder()
seeder.init_app(app, db)
Got Exception