Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the skills of using web.py

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the skills of using web.py". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the skills for using web.py?"

Http,IP and port number

After the program is executed, a line of message will be displayed: http://0.0.0.0:8080/, then type http://localhost:8080 in the browser and you will be able to visit the welcome page.

Http

What is http? it is a protocol. Some websites use https and do more secure processing on the basis of http. We went to visit a website. In principle, there was a communication between our computer and a computer on the website. Everyone's communication content should abide by this agreement, otherwise, the other party would not understand what you were saying.

Localhost

In the address you enter in your browser, there is a "localhost", which is actually equivalent to 127.0.0.1, and this IP address is the loopback address, which is your computer itself.

Port number

There is a 8080 after the localhost, and this is the port number. If your machine wants to communicate with the other party, you need to know what the other party's IP is. If you know the IP, you also need to know the port number. In fact, this is also easy to understand. When you get on the train, you have to follow the carriage. The computer is just more stringent. The other side opened the port 8080. If you send the message to another port, it will not receive it.

0.0.0.0 and 127.0.0.1

After the web program starts, it displays a line of http://0.0.0.0:8080/, which is very similar to what you type in the browser, but the meaning is completely different.

Let's start with the middle IP. This IP usually has only two values. 0.0.0.0 means that all machines can access it, and 127.0.0.1 means that only this machine can access it.

Let colleagues visit

After you start the web program, you can tell your colleagues your local IP address. Suppose your IP is 192.168.0.101, then your colleague can type http://192.168.0.101:8080 in his browser and you can see the welcome interface. If it is 127.0.0.1, your colleagues will not be able to access it.

8080 is followed by 0.0.0.0, which is the port number, but the meaning is different from that of 8080 in your browser. 8080 here refers to the port number of 8080, which refers to the port number of program listener 8080. Any requests for access are sent to the program, and then sent to your browser after processing.

Comb the train of thought

Now, let me sort it out. You have started a web program, which I call Xiao w. Xiao w said: I have opened port 8080 to receive your request. You can send me a message.

At this point, you type http://localhost:8080 in the browser, click enter, the browser will know, to access the local port 8080, send the request to this port.

Xiao w received the request and sent the words "welcome" to the browser according to the logic in your program.

It's the same process when your colleague visits your web program in the browser. Xiao w knows not only what the request is, but also who sent it, so after your colleague sends the request, Xiao w sends "welcome" to your colleague.

Above, is a simple explanation of http,IP, port number, in order to be easy to understand, some statements are not rigorous, but help you understand the program.

How many doubts

Some friends may think of several questions: why do you not need to fill in the IP or write the port number when you visit Baidu?

You enter http://www.baidu.com, you can access Baidu, indeed did not enter Baidu's IP and port number, baidu.com is a domain name, DNS server recorded its corresponding IP address, so, you do not have to enter IP, after all, IP is very difficult to remember, and the reason not to write the port number, because Baidu opened 80 port number, and 80 is the default port number, you do not write, the browser default to access this port.

Now, you also want to use the 80 port number. is that okay? this depends on the situation. I can't use it on my own machine. The reason is probably because of permissions, so I'll change it to 1043.

At this point, I believe you have a deeper understanding of "what are the skills for the use of web.py?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report