Learn Flask Routing and Views for Web Development

importing flask module is mandatory in the project n.w
1 / 4
Embed
Share

Explore the importance of importing Flask module in a project, understand Flask constructor, define routes and functions, and create a simple web application using Flask for effective web development.

  • Flask
  • Web Development
  • Routing
  • Views
  • Python

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Importing Flask Module is mandatory in the project Flask constructor app=Flask(__name__) takes name of current module as an argument. First.py from flask import Flask app=Flask(__name__) http://127.0.0.1:5000/ Hello World @app.route('/') def index(): return '<h1>Hello World</h1>'

  2. Route Function App.route(route, options) URL binding with the function Eg. @app.route('/') List of parameters to be forwarded to the underlying rule object

  3. from flask import Flask app=Flask(__name__) @app.route('/') def home(): return '<h1>Hello World</h1>' @app.route('/about') def about(): return '<h2>Vivekanand College, Kolhapur<h2>' @app.route('/blog') def blog(): return '<h2>This is the blog of College</h2>'

  4. http://127.0.0.1:5000/ @app.route('/') def home(): return '<h1>Hello World</h1>' Hello World http://127.0.0.1:5000/about @app.route('/about') def about(): return '<h2>Vivekanand College, Kolhapur<h2>' Vivekanand College, Kolhapur http://127.0.0.1:5000/blog @app.route('/blog') def blog(): return '<h2>This is the blog of College</h2>' This is the blog of College

More Related Content