Python module for making it easy and consistent to connect to MongoDB via PyMongo either in Flask or in a non-flask application
Project description
Python module for making it easy and consistent to connect to MongoDB via PyMongo either in Flask or in a non-flask application
Usage
config.py as referenced below
MONGO_HOST = 'localhost' MONGO_PORT = '27017' MONGO_USERNAME = 'user' MONGO_PASSWORD = 'password'
Flask
from flask import Flask from happymongo import HapPyMongo # Our apps config.py import config app = Flask(__name__) app.config.from_object(config) mongo, db = HapPyMongo(app)
Python from import
from happymongo import HapPyMongo # Our apps config.py import config mongo, db = HapPyMongo(config)
Python from dict
from happymongo import HapPyMongo config = { 'MONGO_HOST': 'localhost' } mongo, db = HapPyMongo(config)
Config directives
Directive |
Description |
---|---|
MONGO_URI |
A MongoDB URI which is used in preference of the other configuration variables. |
MONGO_HOST |
The host name or IP address of your MongoDB server. Default: “localhost”. |
MONGO_PORT |
The port number of your MongoDB server. Default: 27017. |
MONGO_DATABASE |
The database name to make available as the db attribute. Default: app.name for Flask or the filename of the including file without the .py extension |
MONGO_USERNAME |
The user name for authentication. Default: None |
MONGO_PASSWORD |
The password for authentication. Default: None |
MONGO_KWARGS |
A dictionary of keyword arguments to send to pymongo.MongoClient |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file happymongo-py3-0.1.3.tar.gz
.
File metadata
- Download URL: happymongo-py3-0.1.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.25.1 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.5.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 770cae0b13794e0d57d3e68fdb95da9f2f1a9afa0375c1ae84af868f2777f363 |
|
MD5 | f691d61123aac5658ff467af5712fd28 |
|
BLAKE2b-256 | ac8b6976832334eeb8c33edb2750e7235f1207de9b93e372cdfa077cace95d33 |
File details
Details for the file happymongo_py3-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: happymongo_py3-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.7.1 requests/2.25.1 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.5.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5daf50e20657a2d2bf34a50f0756a6b05a6109f3c1d7c8a18596be8f0ceed8f |
|
MD5 | 21288b8083df282239d252b4169a1b8b |
|
BLAKE2b-256 | 8f69556cefffd170b0786f8ad6354f9ab52fc5644a9672c684fefca435b78763 |