Django Framework Combat: Build a small server operations website (i)

Source: Internet
Author: User

This article will encounter a lot of code, if you want the source code of the small partner, I have already shared the below, want to be able to study the


I have been engaged in Python development for many years, many small partners want to learn about the Web Django framework, I use the Django framework to do a series of practical projects, welcome to subscribe. Welcome to subscribe to the public number: Python from the program Ape to the programmer, or add 4913.08659, code: Cauchy, Code: Cauchy. There is no understanding can be asked in the inside, but also a study of live data platform

Objective

?? Whether it's operations or development or testing, working with Linux servers, common operations such as viewing CPU or memory status, viewing and modifying server time, viewing or modifying server configuration files, viewing or reviewing the system's logs in real time, restarting a process in the server, and so on. If not next to the server, you will typically choose to use remote SSH tools such as Xshell to log on to the server to perform the required operations. If there is a web tool, the tool will be very convenient for the target users to provide services, for development, you can pay more attention to the code itself, for the operation is easy to directly know the state of the server, for testers, improve the efficiency of testing. I had no experience in developing this Django-based Web tool before, and it was all stones, so there were a lot of problems in the development process, and we solved and reached the requirement one after the other, which also brought some code reuse directly. These articles will contain some front-end techniques (WebSocket, Ajax, routing) and some back-end small modules (Paramiko, OpenID, webserver, MySQL), which in turn will derive many small details and methods in the patchwork of these small parts. This article will do a review, although there is a better way to achieve a multi-functional, the technical difficulties involved are not small, but also hope to help the needs of children's shoes.

Content Introduction

The article default reader already has the Django development experience, the article directly skipped the numerous beginner content, directly starts the small project

These functions are actually very simple, like building blocks, the key is to meet and solve the problem is to make the need for children's shoes to take a little detour. The website style is shown in 1 and Figure 2 (this is the main page, there is no landing screen and other features interface):





Source

Environment

?? Python version: python2.7?? Django version: python-django-1.11?? Database: Mysql?? Mysql_python Connection Library:https://pan.baidu.com/s/14WpD ... Password: 0h5h

Source

?? Website Source Link:https://pan.baidu.com/s/1uix-... password: J4SW?? Dashgum front-end Template:https://pan.baidu.com/s/1FHCX ... Password: bo8d

Usage

?? We need to change the following places to run the website locally.

Server login configuration in Settings:



A private key is required to place the private key under Webtool/webtool:


Modify some of the server paths and command lines in functions:



Conclusion

?? This small project uses a few techniques, but basically it can interact with the server by invoking the Paramiko module and server interaction in Python via the website. Although the function of the site is not many, but the interaction of ideas can be extrapolate write more features pages (such as: CPU, memory warning, etc.), some of the complex server function is best to write a shell script in the server to provide the site background calls, the front-end parts can be found in the Dashgum suitable.


Django Framework Combat: Build a small server operations website (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.