Top

Create New Page

In this guide we will see how we can create a new page and render it through a path.

Step 1: Using our html structure first create an html page you want to render.

Step 2: Import the dependencies require to render the template in the routes.py file.

from flask import Flask, render_template
            

Step 3: Create a route and give it a function to return the template that you have just created.

main = Blueprint('main',__name__)
@main.route('/page_path')
def new_page_function():
  return render_template("html_page_path")
              

Thats all you have to do, now you can access the page through the new path that you have created