From 80d926db2c5e42578eeb07c1a1066cd27e4a7f25 Mon Sep 17 00:00:00 2001 From: Ajay NS Date: Thu, 30 Mar 2017 10:59:49 +0530 Subject: [PATCH 1/2] Add code for MongoDB support --- app.py | 8 ++++++++ requirements.txt | 2 ++ 2 files changed, 10 insertions(+) diff --git a/app.py b/app.py index 64d2796c..caed0f3f 100644 --- a/app.py +++ b/app.py @@ -4,6 +4,7 @@ from flask import Flask, render_template, request # from flask.ext.sqlalchemy import SQLAlchemy +# from flask_pymongo import PyMongo import logging from logging import Formatter, FileHandler from forms import * @@ -16,6 +17,7 @@ app = Flask(__name__) app.config.from_object('config') #db = SQLAlchemy(app) +#mongo = PyMongo(app) # Automatically tear down SQLAlchemy. ''' @@ -36,6 +38,12 @@ def wrap(*args, **kwargs): return redirect(url_for('login')) return wrap ''' + +# Config MongoDB +''' +app.config['MONGO_DBNAME'] = 'restdb' +app.config['MONGO_URI'] = 'mongodb://localhost:27017/restdb' +''' #----------------------------------------------------------------------------# # Controllers. #----------------------------------------------------------------------------# diff --git a/requirements.txt b/requirements.txt index 74fd43ac..d98b35b3 100755 --- a/requirements.txt +++ b/requirements.txt @@ -14,3 +14,5 @@ itsdangerous==0.23 paramiko==1.12.2 pycrypto==2.6.1 wsgiref==0.1.2 +pymongo==3.4.0 +Flask-PyMongo==0.4.1 \ No newline at end of file From 4addf3b8258fa3c6899f96aa505e1a5f6cf7a205 Mon Sep 17 00:00:00 2001 From: Ajay NS Date: Thu, 30 Mar 2017 11:08:54 +0530 Subject: [PATCH 2/2] Fix typo --- app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index caed0f3f..6cfabe1b 100644 --- a/app.py +++ b/app.py @@ -41,8 +41,8 @@ def wrap(*args, **kwargs): # Config MongoDB ''' -app.config['MONGO_DBNAME'] = 'restdb' -app.config['MONGO_URI'] = 'mongodb://localhost:27017/restdb' +app.config['MONGO_DBNAME'] = 'dbname' +app.config['MONGO_URI'] = 'mongodb://localhost:27017/dbname' ''' #----------------------------------------------------------------------------# # Controllers.