flask-mongoengine
Flask-MongoEngine is a Flask extension that provides integration with MongoEngine and WTF model forms.
What it is and what it does
Flask-MongoEngine is a Flask extension that bridges Flask applications with MongoEngine, a MongoDB object-document mapper. It manages MongoDB connections for your app, handles initialization via the extension pattern (immediate or deferred via init_app), and automatically generates WTForms from your MongoEngine document models. The package also extends MongoEngine's QuerySet with Flask-specific helpers like get_or_404, first_or_404, and pagination methods, plus optional session storage in MongoDB and debug toolbar integration.
You define your data models as MongoEngine documents, then use model_form() to automatically create WTForms from them. The extension handles field type mapping (StringField to TextAreaField, ReferenceField to SelectField, ListField to FieldList, etc.) and supports customization hints. Connection configuration is straightforward via app.config dictionaries or individual MONGODB_* settings, with support for URI-style connections and authentication.
Use it for:
- Build a Flask web app with MongoDB as the primary database, letting the extension manage connections and model integration.
- Generate HTML forms automatically from MongoEngine document definitions without writing form classes manually.
- Add pagination to query results and template rendering with built-in paginate() and paginate_field() QuerySet methods.
- Store Flask sessions in MongoDB instead of memory or Redis using MongoEngineSessionInterface.
- Debug MongoDB queries in Flask-DebugToolbar by registering the MongoDebugPanel.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Flask-MongoEngine integrates MongoEngine document models with Flask, handling MongoDB connection management and providing WTForms model form generation for your MongoEngine documents.
Yes, with conditions. Flask-MongoEngine is stable and low-friction to install, with no known vulnerabilities and a permissive license. However, it is dormant—last release 2020-11-21, last commit 2024-01-18—so it may lag behind current Flask or MongoEngine releases. Install it if you are working with a compatible Flask and MongoEngine stack; do not expect active maintenance or rapid fixes for compatibility issues.
Install
flask-mongoengine on PyPI
pip
pip install flask-mongoengineuv
uv add flask-mongoenginepoetry
poetry add flask-mongoengineInstalling flask-mongoengine
Before you install
Low install friction with a pure-wheel distribution. However, the package is dormant—last release was 2020-11-21 and last commit 2024-01-18—so maintenance is minimal. It still receives downloads but expect no active support for newer Flask or MongoEngine versions.
License in practice
BSD license is permissive, allowing commercial and private use with minimal restrictions. You may use, modify, and distribute this package freely as long as you retain the BSD license notice.
Quickstart
pip install flask-mongoengine
from flask import Flask
from flask_mongoengine import MongoEngine
app = Flask(__name__)
app.config['MONGODB_SETTINGS'] = {'db': 'mydb', 'host': 'localhost'}
db = MongoEngine(app)
Requires a running MongoDB instance; by default expects mongod on localhost:27017. Connection settings must be configured via app.config before or after initialization.
Verify before relying
- Compatibility with current Flask and MongoEngine versions (last release 2020-11-21)
- Whether dormant status indicates unresolved issues with modern Python versions or newer dependencies
- Support for async/await patterns in modern Flask applications
Package facts
| License | BSD (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — Flask, WTForms, Flask-WTF, mongoengine |
| Maintenance | dormant — 2,092 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 100,126/month — #12,999 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flask_mongoengine-1.0.0-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
mongoengineMongoEngine provides an Object-Document Mapper…
permissive · top 5,000 on PyPI
Flask-PyMongoFlask-PyMongo integrates MongoDB database…
permissive · top 15,000 on PyPI
marshmallow-mongoengineGenerates marshmallow schemas automatically…
permissive · top 15,000 on PyPI
Flask-WTFFlask-WTF integrates WTForms with Flask to…
permissive · top 5,000 on PyPI
WTForms-SQLAlchemyGenerates WTForms forms from SQLAlchemy models…
permissive · top 15,000 on PyPI
WTForms-AlchemyAutomatically generates WTForms form classes…
permissive · top 15,000 on PyPI
Flask-MailFlask-Mail adds email-sending functionality to…
permissive · top 5,000 on PyPI
Flask-AdminFlask-Admin adds a customizable admin interface…
permissive · top 5,000 on PyPI
mixerMixer generates test data and model instances…
permissive · top 15,000 on PyPI
Bootstrap-FlaskBootstrap-Flask provides Jinja macros that…
permissive · top 15,000 on PyPI