Multimedia Programming II - WDMM1405 (Python Programming II) - Flask Examples source code
https://mksaad.wordpress.com/2019/02/05/python-ii-wdmm1405/
https://github.com/motazsaad/WDMM1405
pip install 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.
Setting up a basic project structure then developing a static site, styled with Bootstrap.
Take the following files
- bootstrap.min.css
- bootstrap.min.js
- Makes your website responsive
- improve the style of your website
- 200 OK
- 404 not found
- 500 server error
- GET: get resource from server (html page, jpg image, pdf file, ...etc)
- POST: send data to server. Usually used with html forms
design master template and reuse it
SQL: Structured Query Language
Lite == Light ==
Database: set of related tables
retrieve date from a single table
Sqlite Browser
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
- Option 1: Basic Flask (Jsonify function)
- Option 2: Flask-RESTful (pip install Flask-RESTful)