In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the method of building personal cloud disk based on Python". In daily operation, I believe that many people have doubts about what is the method of building personal cloud disk based on Python. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "what is the method of building personal cloud disk based on Python?" Next, please follow the editor to study!
1. Brief introduction
When we want to upload files from local to the cloud server, tools such as pscp are commonly used, but we can't avoid having to write some repetitive code every time we upload. The author recently found a Python-based tool updog, which can help us build a service similar to cloud disk on the server, so that we can upload and download files in the web interface, which is very convenient and, most importantly, very simple!
two。 Use updog
The author is used to using putty to connect to the CVM, as shown in figure 1 (IP address and other information has been coded). After logging in, we go to the page:
Figure 1
Because updog is a third-party package for Python, let's directly use pip3 install updog to install updog. Make sure that the server has Python 3.x installed before installation:
Figure 2
Then we can directly use updog to start the service, and pass parameters to start the service in the following format:
Updog-d DIRECTORY-p PORT-- password PASSWORD
Parameter d indicates the root directory opened by the service, that is, after the service is enabled, the access service cannot view directories of the same level or above, which defaults to the current directory; parameter p indicates the open port of the service, with a default of 9090 Parameter password indicates password, and HTTP basic authentication is used for password protection. Useless user name and no password by default means direct access. Of course, this is not recommended. For example, we first change to the root directory, and then create a folder named updog, and enable the updog service in this folder:
Cd / mkdir updog cd updog updog-p 666-- password UPDOG
Figure 3
In this way, we enable the updog service on our CVM and access the service through ip address: 666:
Figure 4
You can see that we are prompted to enter the password at this time. Instead of entering the user name, enter the password UPDOG to enter the service:
Figure 5
You can see that on this page, we can upload and download files at will (but we cannot modify the files, we must operate on the server), but there is a problem. When we close putty, the updog service we just opened stops and cannot be accessed normally. In this case, we just need to change the command to enable the service as follows:
Nohup updog-p 666-- password UPDOG &
At this point, our service hangs in the background and will not stop with the shutdown of putty:
Figure 6
And a server can enable multiple updog services with different configurations, which is very convenient. If you want to shut down the service that was suspended in the background, you can first find the corresponding program ID through the fuser-v-n tcp port number, and then use the kill-s 9 program ID to shut down the specified service:
Figure 7 at this point, the study on "what is the method of building a personal cloud disk based on Python" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.