Answer the question
In order to leave comments, you need to log in
How to output all records from mongo db to flask?
How to display all records from the database to the web using flask?
My code outputs only one, where instead of text, these are the things:
My attempts in Flask:
from flask import Flask, render_template
from pymongo import MongoClient
app = Flask(__name__)
client = MongoClient("mongodb+srv://")
db = client.database
collection = db.archive
@app.route('/')
def index():
""" Пробововал подключать и Flask-pymongo меняя на команды из документации, толку особого не дало"""
title = collection.find()
link = collection.find()
time = collection.find()
text = collection.find()
return render_template('index.html', title=title, link=link, time=time, text=text)
if __name__ == "__main__":
app.run(debug=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question