# home
# dashboard
from flask import Blueprint, render_template, Flask, session
from flask_assets import Environment, Bundle
from pymongo import MongoClient
from pymongo.collation import Collation

app = Flask(__name__)

init_page = Blueprint('initial', __name__,template_folder='template')

def link(valores):
	return valores["data"]

def autor(valores):
	return valores["name"]

def likes(valores):
	return valores["likes"]


@init_page.route('/')
def views():
	if not session:
		return render_template("login.html")
	else:
		#### Configurações do banco ######
		client = MongoClient('mongodb://root:r00t123@ds259001.mlab.com/weed',59001)
		db = client.weed
		collection = db['Images']
		images = collection.find({})
		
		return render_template("show.html",images=images)