import os
from flask import Flask, redirect, url_for, request, render_template
from pymongo import MongoClient

app = Flask(__name__)

client = MongoClient('mongodb-service', 27017, username='USERNAME', password='PASSWORD')
db = client.tododb


@app.route('/')
def todo():

    _items = db.tododb.find()
    items = [item for item in _items]

    return render_template('todo.html', items=items)


@app.route('/new', methods=['POST'])
def new():

    item_doc = {
        'name': request.form['name'],
        'description': request.form['description']
    }
    db.tododb.insert_one(item_doc)

    return redirect(url_for('todo'))

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True)
aa3dd3727fb6c5b68b6debee397748888d0f0e27
<mask token>


@app.route('/')
def todo():
    _items = db.tododb.find()
    items = [item for item in _items]
    return render_template('todo.html', items=items)


@app.route('/new', methods=['POST'])
def new():
    item_doc = {'name': request.form['name'], 'description': request.form[
        'description']}
    db.tododb.insert_one(item_doc)
    return redirect(url_for('todo'))


<mask token>

<mask token>


@app.route('/')
def todo():
    _items = db.tododb.find()
    items = [item for item in _items]
    return render_template('todo.html', items=items)


@app.route('/new', methods=['POST'])
def new():
    item_doc = {'name': request.form['name'], 'description': request.form[
        'description']}
    db.tododb.insert_one(item_doc)
    return redirect(url_for('todo'))


if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)

<mask token>
app = Flask(__name__)
client = MongoClient('mongodb-service', 27017, username='USERNAME',
    password='PASSWORD')
db = client.tododb


@app.route('/')
def todo():
    _items = db.tododb.find()
    items = [item for item in _items]
    return render_template('todo.html', items=items)


@app.route('/new', methods=['POST'])
def new():
    item_doc = {'name': request.form['name'], 'description': request.form[
        'description']}
    db.tododb.insert_one(item_doc)
    return redirect(url_for('todo'))


if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)

import os
from flask import Flask, redirect, url_for, request, render_template
from pymongo import MongoClient
app = Flask(__name__)
client = MongoClient('mongodb-service', 27017, username='USERNAME',
    password='PASSWORD')
db = client.tododb


@app.route('/')
def todo():
    _items = db.tododb.find()
    items = [item for item in _items]
    return render_template('todo.html', items=items)


@app.route('/new', methods=['POST'])
def new():
    item_doc = {'name': request.form['name'], 'description': request.form[
        'description']}
    db.tododb.insert_one(item_doc)
    return redirect(url_for('todo'))


if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)

import os
from flask import Flask, redirect, url_for, request, render_template
from pymongo import MongoClient

app = Flask(__name__)

client = MongoClient('mongodb-service', 27017, username='USERNAME', password='PASSWORD')
db = client.tododb


@app.route('/')
def todo():

    _items = db.tododb.find()
    items = [item for item in _items]

    return render_template('todo.html', items=items)


@app.route('/new', methods=['POST'])
def new():

    item_doc = {
        'name': request.form['name'],
        'description': request.form['description']
    }
    db.tododb.insert_one(item_doc)

    return redirect(url_for('todo'))

if __name__ == "__main__":
    app.run(host='0.0.0.0', debug=True)