Skip to main content

Flask-Pymodm is a simple plugin for Pymodm

Project description

Flask-PyMODM

MongoDB is a document-based database for general purpose use.

Flask-PyMODM is the bridge between Flask and PyMODM, it brings to developers a simplified way to use PyMODM in Flask applications.

Quickstart

To start using Flask-PyMODM, install or update it via pip:

pip install Flask-PyMODM

A Simple Example

from flask import Flask
from flask_pymodm import PyModm


def configure_app(app):
   app.config['MONGODB_DB_NAME'] = 'test'
   app.config['MONGODB_HOST'] = 'localhost'
   app.config['MONGODB_PORT'] = '27017'

def create_app():
   app = Flask(__name__)
   configure_app(app)
   PyModm(app)
   return app

if __name__ == '__main__':
   create_app().run(host='0.0.0.0', port=5000)

Customizing Properties

In order to customize the host, add the following into your app.config (see Configuration Handling for more details):

MONGODB_HOST = "10.10.10.13"                 # default is "localhost"
MONGODB_PORT = "27017"                       # default is "27017"
MONGODB_DB_NAME = "test"                     # default is "my-app"
MONGODB_ALIAS_CONNECTION = "my_connection"   # default is "default"
MONGODB_USERNAME = "my_username"             # default is None
MONGODB_PASSWORD = "my_password"             # default is None

Test

To run test suite use the tox command.

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-Pymodm, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size Flask_Pymodm-0.1.2-py3-none-any.whl (5.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Flask-Pymodm-0.1.2.tar.gz (4.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page