Section 1: What to do
Hello world is good, but Hello world is not enough.
1.The task of ch4:
Use Flask to create one MVC - Model-View-Controller, as Web version of the weather query program.
Learn to develop a application that people can use the web browser to obtain the real-time weather forecast data, realize these functions:
1.Run the inquiry program gather online forecasts in CLI;
2.Open up the web browser and enter the following URL (http://127.0.0.1:5000/ or http://localhost:5000\) in the address field;
3.Enter the name of city to get the latest weather forecast, including the weather profile,such as temperature and wind;
4. Enter "Help" to print the HELP text;
5. Enter "History" to display the history detail of weather forecast;
6.Hit Ctrl-C to stop the server.
7.Advanced task: implementing a mobile adaptation (of course I just ignore it)
2.Basic Knowledge
In particular,Web is the subject of CH4, we have to learn to write web application in Python using the Flask microframework.
More specifically, here is the basic knowledge you need to know:
What is Web,what can it do? Why people invent Web ?
Is there any Web framework of python? How to deal with it to develop the weather query system?
What is Flask? How to use flask to creat a web application?
(1)Why we need templates? and what is Jinja2?
(2)How to get the render_template function? How does it work?
(3)How to keep the logic of the application separate from the layout or presentation(the html part) of the web pages things?
What is the mini process from coding to running of a HTML?
How about the display of "history" and "help"?
3.The tutorial
Read the tutorial of Flask,and run the code of the gived MVP,see what will it happen?
Suppose now you understand the point just a little bit, here are some tutorial of web:
HTML Basic Examples - w3school
Here is w3school in chinese.
Accessing Request Data - Flask
Rendering Templates — Flask Documentation (0.12) Welcome to Jinja2 — Jinja2 2.7 documentation
Did you get lost?
Anyway, these files totally overwhelmed me when I trying to process so much information.
But I still have to move on, so keep Reading
and then read the book Flask Web Development: Developing Web Applications with Python and so on...
Do you know how to code it?
Hello world is simple, but Hello world is not enough.
4. In case , Go Further:
1. CSS
CSS stands for Cascading Style Sheets, and it describes how HTML elements are to be displayed on screen, paper, or in other media.
The tutorial :
Cascading Style Sheets - Wikipedia
2.Bootstrap :
Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web. Bootstrap