Skip to content

Commit

Permalink
v0.9.18:Fix BUG of PyMongo Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
noahziheng committed Jul 15, 2018
1 parent 0d8d31f commit e19fde5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions libfreeiot/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
from flask_pymongo import PyMongo
from libfreeiot.config import CONFIG

mongo = PyMongo()
mongo = None

def create_app(config_name, scope = None):
"""
Function for create Flask App instance
"""
global mongo
if scope is None:
scope = dict()
app = Flask(__name__) # Initialize app
Expand All @@ -22,8 +23,11 @@ def create_app(config_name, scope = None):
app.config.from_object(CONFIG[config_name])
CONFIG[config_name].init_app(app)

app.config["MONGO_URI"] = "mongodb://" + app.config["MONGO_HOST"] + ":" + str(app.config["MONGO_PORT"]) + "/" + app.config["MONGO_DBNAME"]
print(app.config["MONGO_URI"])

# Init MongoDB Ext
mongo.init_app(app)
mongo = PyMongo(app)

from libfreeiot.core.routes import create_routes
app, api = create_routes(app, scope) # Initialize api services with Routes definition
Expand Down
1 change: 1 addition & 0 deletions libfreeiot/core/resources/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from flask_jwt_simple import jwt_required
from bson import json_util, ObjectId
from libfreeiot.core import mongo
from libfreeiot.app import scope

class Device(Resource):
"""
Expand Down
2 changes: 1 addition & 1 deletion libfreeiot/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"""

script_name = 'libfreeiot'
__version__ = '0.9.17'
__version__ = '0.9.18'

0 comments on commit e19fde5

Please sign in to comment.