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:

  1. What is Web,what can it do? Why people invent Web ?

  2. Is there any Web framework of python? How to deal with it to develop the weather query system?

  3. 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?

  4. What is the mini process from coding to running of a HTML?

  5. 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 Editors - w3school

HTML Basic Examples - w3school

HTML Elements - w3school

HTML Input Types - w3school

Here is w3school in chinese.

HTTP Methods: GET vs. POST

HTTP Methods - Flask

Accessing Request Data - Flask

Rendering Templates - Flask

Jinja2 2.7 documentation

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

liaoxuefeng.com

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

HTML Styles - CSS

CSS Tutorial

CSS Fonts - w3school

2.Bootstrap :

Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web. Bootstrap

results matching ""

    No results matching ""