def __init__(self): self.client1 = mongoDB(os.environ['host-0f-mongo1'], 27017)
from flask import Flask, url_for, render_template, redirect, request from pymongo import MongoClient as mongoDB import os app = Flask(__name__) # client = mongoDB('http://*****:*****@app.route('/') @app.route('/list') def show_data(): return render_template('index.html', name=name, table=table.find()) @app.route("/action1", methods=['POST']) def action1(): table.insert_one({ "name": request.values.get("name"), "email": request.values.get("email"), "date": request.values.get("date"), "pr": request.values.get("pr") }) return redirect("/list")