Skip to content

Flask is a micro web framework powered by Python. It's API is fairly small, making it easy to learn and simple to use. But don't let this fool you, as it's powerful enough to support enterprise-level applications handling large amounts of traffic. You can start small with an app contained entirely in one file, then slowly scale up to multiple fi…

KhaledAbuNada-AI/Python-Programming----Flask-Examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask

Multimedia Programming (Python Programming II) - Flask Examples source code

Installation

pip install flask


Part 1

Introduction to Flask

Flask is a micro web framework powered by Python. It's API is fairly small, making it easy to learn and simple to use. But don't let this fool you, as it's powerful enough to support enterprise-level applications handling large amounts of traffic. You can start small with an app contained entirely in one file, then slowly scale up to multiple files and folders in a well-structured manner as your site becomes more and more complex.

Contents

Setting up a basic project structure then developing a static site, styled with Bootstrap.

get the bootstrap

https://getbootstrap.com/

Take the following files

  • bootstrap.min.css
  • bootstrap.min.js

advantage

  • Makes your website responsive
  • improve the style of your website

HTTP messages code

  • 200 OK
  • 404 not found
  • 500 server error

HTTP Methods

  • GET: get resource from server (html page, jpg image, pdf file, ...etc)
  • POST: send data to server. Usually used with html forms

Mater template (template inheritance)

design master template and reuse it


Deal with Databases (SQLite)

SQL: Structured Query Language

Lite == Light ==

Database: set of related tables

retrieve date from a single table

Tool

Sqlite Browser


Build REST API using Python and Flask

API = Application Program Interface

Developers use API to build applications

Common Example: The weather App

Ordinary Flask app pages return a string or html. There is a need for standard format to extract result from it. It is JSON format

JSON == JAVA Simple Object Notation == Python Dictionary

Options

  • Option 1: Basic Flask (Jsonify function)
  • Option 2: Flask-RESTful (pip install Flask-RESTful)

References

https://github.com/realpython/discover-flask

About

Flask is a micro web framework powered by Python. It's API is fairly small, making it easy to learn and simple to use. But don't let this fool you, as it's powerful enough to support enterprise-level applications handling large amounts of traffic. You can start small with an app contained entirely in one file, then slowly scale up to multiple fi…

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages