from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
from .momentjs import momentjs

app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
app.jinja_env.globals['momentjs'] = momentjs

# App Config
config = configparser.ConfigParser()
config.read('config/config.ini')

app.config['MONGODB_DB'] = config['MongoDB']['db_name']
app.config['MONGODB_HOST'] = config['MongoDB']['host']
app.config['MONGODB_PORT'] = int(config['MongoDB']['port'])
app.config['MONGODB_USERNAME'] = config['MongoDB']['username']
app.config['MONGODB_PASSWORD'] = config['MongoDB']['password']

db = MongoEngine(app)

def register_blueprints(app):
    # Prevents circular imports
    from weighttracker.views.measurement_views import measurements
    app.register_blueprint(measurements)
    from weighttracker.views.inspiration_views import inspirations
    app.register_blueprint(inspirations)
    from weighttracker.views.foodjournal_views import foodjournals
    app.register_blueprint(foodjournals)

register_blueprints(app)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')

def catch_all(path):
    return render_template('index.html')


if __name__ == '__main__':
  app.run()
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
from .momentjs import momentjs

app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
app.jinja_env.globals['momentjs'] = momentjs

# App Config
config = configparser.ConfigParser()
config.read('config/config.ini')

app.config['MONGODB_DB_SETTINGS'] = {
  'name': config['MongoDB']['db_name'],
  'host': config['MongoDB']['host'],
  'port': int(config['MongoDB']['port']),
  'username': config['MongoDB']['username'],
  'password': config['MongoDB']['password']}

db = MongoEngine(app)

def register_blueprints(app):
    # Prevents circular imports
    from weighttracker.views.measurement_views import measurements
    app.register_blueprint(measurements)
    from weighttracker.views.inspiration_views import inspirations
    app.register_blueprint(inspirations)
    from weighttracker.views.foodjournal_views import foodjournals
    app.register_blueprint(foodjournals)

register_blueprints(app)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')

def catch_all(path):
    return render_template('index.html')


if __name__ == '__main__':
  app.run()
Update how we set the connection information for MongoDB to support Mongo 3.0.5
Update how we set the connection information for MongoDB to support Mongo 3.0.5

Signed-off-by: Robert Dempsey <715b5a941e732be1613fdd9d94dfd8e50c02b187@gmail.com>

  from flask import Flask, render_template
  from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
  import configparser
  from .momentjs import momentjs
  
  app = Flask(__name__)
  # Security
  WTF_CSRF_ENABLED = True
  app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
  app.jinja_env.globals['momentjs'] = momentjs
  
  # App Config
  config = configparser.ConfigParser()
  config.read('config/config.ini')
  
- app.config['MONGODB_DB'] = config['MongoDB']['db_name']
- app.config['MONGODB_HOST'] = config['MongoDB']['host']
- app.config['MONGODB_PORT'] = int(config['MongoDB']['port'])
- app.config['MONGODB_USERNAME'] = config['MongoDB']['username']
- app.config['MONGODB_PASSWORD'] = config['MongoDB']['password']
+ app.config['MONGODB_DB_SETTINGS'] = {
+   'name': config['MongoDB']['db_name'],
+   'host': config['MongoDB']['host'],
+   'port': int(config['MongoDB']['port']),
+   'username': config['MongoDB']['username'],
+   'password': config['MongoDB']['password']}
  
  db = MongoEngine(app)
  
  def register_blueprints(app):
      # Prevents circular imports
      from weighttracker.views.measurement_views import measurements
      app.register_blueprint(measurements)
      from weighttracker.views.inspiration_views import inspirations
      app.register_blueprint(inspirations)
      from weighttracker.views.foodjournal_views import foodjournals
      app.register_blueprint(foodjournals)
  
  register_blueprints(app)
  
  @app.route('/', defaults={'path': ''})
  @app.route('/<path:path>')
  
  def catch_all(path):
      return render_template('index.html')
  
  
  if __name__ == '__main__':
    app.run()
Update how we set the connection information for MongoDB to support Mongo 3.0.5
## Code Before:
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
from .momentjs import momentjs

app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
app.jinja_env.globals['momentjs'] = momentjs

# App Config
config = configparser.ConfigParser()
config.read('config/config.ini')

app.config['MONGODB_DB'] = config['MongoDB']['db_name']
app.config['MONGODB_HOST'] = config['MongoDB']['host']
app.config['MONGODB_PORT'] = int(config['MongoDB']['port'])
app.config['MONGODB_USERNAME'] = config['MongoDB']['username']
app.config['MONGODB_PASSWORD'] = config['MongoDB']['password']

db = MongoEngine(app)

def register_blueprints(app):
    # Prevents circular imports
    from weighttracker.views.measurement_views import measurements
    app.register_blueprint(measurements)
    from weighttracker.views.inspiration_views import inspirations
    app.register_blueprint(inspirations)
    from weighttracker.views.foodjournal_views import foodjournals
    app.register_blueprint(foodjournals)

register_blueprints(app)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')

def catch_all(path):
    return render_template('index.html')


if __name__ == '__main__':
  app.run()
## Instruction:
Update how we set the connection information for MongoDB to support Mongo 3.0.5
## Code After:
from flask import Flask, render_template
from flask.ext.mongoengine import MongoEngine, MongoEngineSessionInterface
import configparser
from .momentjs import momentjs

app = Flask(__name__)
# Security
WTF_CSRF_ENABLED = True
app.config['SECRET_KEY'] = '2bN9UUaBpcjrxR'
app.jinja_env.globals['momentjs'] = momentjs

# App Config
config = configparser.ConfigParser()
config.read('config/config.ini')

app.config['MONGODB_DB_SETTINGS'] = {
  'name': config['MongoDB']['db_name'],
  'host': config['MongoDB']['host'],
  'port': int(config['MongoDB']['port']),
  'username': config['MongoDB']['username'],
  'password': config['MongoDB']['password']}

db = MongoEngine(app)

def register_blueprints(app):
    # Prevents circular imports
    from weighttracker.views.measurement_views import measurements
    app.register_blueprint(measurements)
    from weighttracker.views.inspiration_views import inspirations
    app.register_blueprint(inspirations)
    from weighttracker.views.foodjournal_views import foodjournals
    app.register_blueprint(foodjournals)

register_blueprints(app)

@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')

def catch_all(path):
    return render_template('index.html')


if __name__ == '__main__':
  app.run()