SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Flask is one of the easiest ways to bring your Python
skills online. It's a great micro framework used by
thousands of people to create prototypes and small
web apps.
Introduction:
 Flask is a micro web application framework written
in Python and based on the Werkzeug toolkit(WSGI is the Web
Server Gateway Interface. It is a specification that describes
how a web server communicates with web applications, and how
web applications can be chained together to process one request.
WSGI is Python standard ) and Jinja2 template
engine[Template engines are tools to separate program-logic
and presentation into two independent parts. This makes the
development of both logic and presentation easier, improves
flexibility and eases modification and maintenance].
 As of 2015, the latest stable version of Flask is 0.10.1.
 Examples of applications that make use of the Flask framework
are Pinterest, LinkedIn, as well as the community web page
for Flask itself.
Flask:
 Flask is called a micro framework because it does not
presume or force a developer to use a particular tool or
library . It has no database abstraction layer, form
validation, or any other components where pre-
existing third-party libraries provide common
functions. However, Flask supports extensions that can
add application features as if they were implemented
in Flask itself. Extensions exist for object-relational
mappers, form validation, upload handling, various
open authentication technologies and several common
framework related tools.
Features:
 Contains development server and debugger
 Integrated support for unit testing
 RESTful request dispatching
 Uses Jinja2 templating
 Support for secure cookies (client side sessions)
 100% WSGI 1.0 compliant
 Unicode-based
 Extensive documentation
 Google App Engine Compatibility
 Extensions available to enhance features desired
Installing Flask:
 You will need Python 2.6 or higher to get started
 (All dependencies are installed by using `pip install Flask`.
I encourage you to use a virtualenv.) virtualenv is a tool to
create isolated Python environments. Virtualenv creates a
folder which contains all the necessary executables to use
the packages that a Python project would need.
 Before getting started, we need to install Flask. Because
systems vary, things can sporadically go wrong during these
steps. If they do, like we all do, just Google the error
message or leave a comment describing the problem.
VERTUALENV:
Example:
 from flask import Flask app = Flask(__name__)
@app.route("/") def hello(): return "Hello World!" if
__name__ == "__main__": app.run()
Hello world:
Debug Mode:
app.run(debug=True)
SQLALCHEMY
For larger applications use SQLAlchemy that handles database
connections in a more intelligent way, allows you to target
different relational databases at once and more.
FORMS:
TUTORIAL: blogging application flaskr
1. User sign in and out with credentials specified in the configuration. Only one user is supported.
2. when the user is logged in they can add new entries to the page consisting of a text-only title and
some HTML for the text.
3. The page shows all entries so far in reverse order (newest on top) and the user can add new ones from there if
logged in
Setting up the Project Structure
 Let's create a couple of folders
and files within flaskapp/ to
keep our web app organized.
 Within flaskapp/, create a folder, app/, to contain all your
files. Inside app/, create a folder static/; this is where we'll
put our web app's images, CSS, and JavaScript files, so
create folders for each of those, as demonstrated above.
Additionally, create another folder, templates/, to store the
app's web templates. Create an empty Python
file routes.py for the application logic, such as URL
routing.
 And no project is complete without a helpful description,
so create a README.mdfile as well.
Creating a Home page:
 As a first step, we'll define our page layout in a skeleton
HTML document layout.html and put it inside
the templates/ folder
app/templates/layout.html
 let's create another file home.html:
app/templates/home.html
 layout.html defines all of the common elements of
your site
 home.html is placed in the templates/ folder. Now, we
need to map a URL to it so we can view it in the
browser. Let's open up routes.py and do this:
 app/routes.py
 Return to the command line, and type:
$ python routes.py
 Visit http://localhost:5000/ in your favorite web
browser.
REFRENCE LINKS:
 WIKIPIDIA
 http://flask.pocoo.org/
 Slideshare.com
 www.fullstackpython.com
 www.google.co.in
 http://code.tutsplus.com/tutorials/an-introduction-
to-pythons-flask-framework--net-28822
MADE BY:
MAMTA
RUSTAMJI INSTITUTE OF TECHNOLOGY

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Web develop in flask
Web develop in flaskWeb develop in flask
Web develop in flask
 
JSON: The Basics
JSON: The BasicsJSON: The Basics
JSON: The Basics
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction To Python | Edureka
Introduction To Python | EdurekaIntroduction To Python | Edureka
Introduction To Python | Edureka
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Django Introduction & Tutorial
Django Introduction & TutorialDjango Introduction & Tutorial
Django Introduction & Tutorial
 
Web development with django - Basics Presentation
Web development with django - Basics PresentationWeb development with django - Basics Presentation
Web development with django - Basics Presentation
 
Django for Beginners
Django for BeginnersDjango for Beginners
Django for Beginners
 
Django - Python MVC Framework
Django - Python MVC FrameworkDjango - Python MVC Framework
Django - Python MVC Framework
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
 
Api presentation
Api presentationApi presentation
Api presentation
 

Ähnlich wie Flask

Django Article V0
Django Article V0Django Article V0
Django Article V0
Udi Bauman
 
0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf
radhianiedjan1
 

Ähnlich wie Flask (20)

Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Spring hibernate tutorial
Spring hibernate tutorialSpring hibernate tutorial
Spring hibernate tutorial
 
M365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx VersionM365 global developer bootcamp 2019 Intro to SPFx Version
M365 global developer bootcamp 2019 Intro to SPFx Version
 
CONTENT MANAGEMENT SYSTEM
CONTENT MANAGEMENT SYSTEMCONTENT MANAGEMENT SYSTEM
CONTENT MANAGEMENT SYSTEM
 
Php Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant KillerPhp Conference Brazil - Phalcon Giant Killer
Php Conference Brazil - Phalcon Giant Killer
 
Plugins 2.0: The Overview
Plugins 2.0: The OverviewPlugins 2.0: The Overview
Plugins 2.0: The Overview
 
How create react app help in creating a new react applications
How create react app help in creating a new react applications How create react app help in creating a new react applications
How create react app help in creating a new react applications
 
Introduction to Google App Engine with Python
Introduction to Google App Engine with PythonIntroduction to Google App Engine with Python
Introduction to Google App Engine with Python
 
sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
 
Flask
FlaskFlask
Flask
 
Python Web Framework – A Detailed List of Web Frameworks in Python
Python Web Framework – A Detailed List of Web Frameworks in PythonPython Web Framework – A Detailed List of Web Frameworks in Python
Python Web Framework – A Detailed List of Web Frameworks in Python
 
CTE 323 - Lecture 1.pptx
CTE 323 - Lecture 1.pptxCTE 323 - Lecture 1.pptx
CTE 323 - Lecture 1.pptx
 
django
djangodjango
django
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Company Visitor Management System Report.docx
Company Visitor Management System Report.docxCompany Visitor Management System Report.docx
Company Visitor Management System Report.docx
 
Open Social Frameworks
Open Social FrameworksOpen Social Frameworks
Open Social Frameworks
 
Cakephp manual-11
Cakephp manual-11Cakephp manual-11
Cakephp manual-11
 
Rewriting a Plugin Architecture 3 Times to Harness the API Economy
Rewriting a Plugin Architecture 3 Times to Harness the API EconomyRewriting a Plugin Architecture 3 Times to Harness the API Economy
Rewriting a Plugin Architecture 3 Times to Harness the API Economy
 
Django Article V0
Django Article V0Django Article V0
Django Article V0
 
0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf0506-django-web-framework-for-python.pdf
0506-django-web-framework-for-python.pdf
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

Flask

  • 1. Flask is one of the easiest ways to bring your Python skills online. It's a great micro framework used by thousands of people to create prototypes and small web apps.
  • 2. Introduction:  Flask is a micro web application framework written in Python and based on the Werkzeug toolkit(WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server communicates with web applications, and how web applications can be chained together to process one request. WSGI is Python standard ) and Jinja2 template engine[Template engines are tools to separate program-logic and presentation into two independent parts. This makes the development of both logic and presentation easier, improves flexibility and eases modification and maintenance].  As of 2015, the latest stable version of Flask is 0.10.1.  Examples of applications that make use of the Flask framework are Pinterest, LinkedIn, as well as the community web page for Flask itself.
  • 3. Flask:  Flask is called a micro framework because it does not presume or force a developer to use a particular tool or library . It has no database abstraction layer, form validation, or any other components where pre- existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools.
  • 4. Features:  Contains development server and debugger  Integrated support for unit testing  RESTful request dispatching  Uses Jinja2 templating  Support for secure cookies (client side sessions)  100% WSGI 1.0 compliant  Unicode-based  Extensive documentation  Google App Engine Compatibility  Extensions available to enhance features desired
  • 5. Installing Flask:  You will need Python 2.6 or higher to get started  (All dependencies are installed by using `pip install Flask`. I encourage you to use a virtualenv.) virtualenv is a tool to create isolated Python environments. Virtualenv creates a folder which contains all the necessary executables to use the packages that a Python project would need.  Before getting started, we need to install Flask. Because systems vary, things can sporadically go wrong during these steps. If they do, like we all do, just Google the error message or leave a comment describing the problem.
  • 7. Example:  from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run()
  • 10. SQLALCHEMY For larger applications use SQLAlchemy that handles database connections in a more intelligent way, allows you to target different relational databases at once and more.
  • 12. TUTORIAL: blogging application flaskr 1. User sign in and out with credentials specified in the configuration. Only one user is supported. 2. when the user is logged in they can add new entries to the page consisting of a text-only title and some HTML for the text. 3. The page shows all entries so far in reverse order (newest on top) and the user can add new ones from there if logged in
  • 13. Setting up the Project Structure  Let's create a couple of folders and files within flaskapp/ to keep our web app organized.  Within flaskapp/, create a folder, app/, to contain all your files. Inside app/, create a folder static/; this is where we'll put our web app's images, CSS, and JavaScript files, so create folders for each of those, as demonstrated above. Additionally, create another folder, templates/, to store the app's web templates. Create an empty Python file routes.py for the application logic, such as URL routing.  And no project is complete without a helpful description, so create a README.mdfile as well.
  • 14. Creating a Home page:  As a first step, we'll define our page layout in a skeleton HTML document layout.html and put it inside the templates/ folder app/templates/layout.html
  • 15.  let's create another file home.html: app/templates/home.html  layout.html defines all of the common elements of your site  home.html is placed in the templates/ folder. Now, we need to map a URL to it so we can view it in the browser. Let's open up routes.py and do this:
  • 16.  app/routes.py  Return to the command line, and type: $ python routes.py  Visit http://localhost:5000/ in your favorite web browser.
  • 17. REFRENCE LINKS:  WIKIPIDIA  http://flask.pocoo.org/  Slideshare.com  www.fullstackpython.com  www.google.co.in  http://code.tutsplus.com/tutorials/an-introduction- to-pythons-flask-framework--net-28822