skillfed

flask-mongoengine

Flask-MongoEngine is a Flask extension that provides integration with MongoEngine and WTF model forms.

flask-mongoengine v1.0.0 100.1K downloads/30d#12,999 on PyPI831
Permissive license BSD DORMANT released

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-mongoengine

uv

uv add flask-mongoengine

poetry

poetry add flask-mongoengine

Installing 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

Development Status :: 4 - BetaEnvironment :: Web EnvironmentFramework :: FlaskIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTP :: Dynamic ContentTopic :: Software Development :: Libraries :: Python Modules

Tags

flask mongodb integrationmongoengine flask extensionmongodb orm for flaskflask document databasemongoengine wtformsflask mongo connection managementdocument model forms flask
mongodb-ormflask-extensionform-generation

More Python Modules packages