def posts_show(id): posts = Post.all() post = Post.find(id) return render_template('posts/show.html', post=post)
def blog(id): post = Post.find(id) return render_template('blogs/blog.html', post=post)
def posts_index(): posts = Post.all() return render_template('posts/index.html', posts=posts)
def home(): posts = Post.all() return render_template('pages/home.html', posts=posts)
def show_posts(id): print(id) post = Post.find(id) post = posts[id - 1] return render_template("posts/show.html", post=post)
from flask import Flask, render_template from mocks import Post app = Flask(__name__) posts = Post.all() @app.route('/') def home(): return render_template("home.html") @app.route('/contact') def contact(): return render_template("contact.html") @app.route('/about') def about(): return render_template("about.html") @app.route('/blog') def posts_index(): posts = Post.all() return render_template("posts/index.html", posts=posts) @app.route('/blog/post/<int:id>') def show_posts(id): print(id)
def post_show(id): post = Post.find(id) return render_template('post/show.html', post=post)
def post_index(): posts = Post.all() return render_template('post/index.html', toto=posts)