Django project deployment method, device, computer equipment and storage medium
By using the py/uw test module for detection and automated configuration, the problems of manual configuration and bastion host transmission in Django project deployment are solved, enabling fast and efficient project deployment and data upload.
Patent Information
- Application Number
- CN202010150185.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-05
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2040-03-05
AI Technical Summary
The deployment process of existing Django projects requires manual configuration of parameters and multiple transmissions through a bastion host, which is time-consuming, labor-intensive, and unable to quickly deploy online applications.
The py/uw testing module detects mismatches and missing configurations in the system environment and server interface, automatically modifies the configurations, and achieves automated deployment via the HttpPost interface, avoiding manual configuration and bastion host uploads.
It enables rapid automated deployment of Django projects, improves data upload efficiency, and avoids errors from manual configuration and the inefficiency of bastion host transmission.
Smart Images

Figure CN111475183B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a Django project deployment method, device, computer equipment and storage medium. Background Art
[0002] Django is an open source web application framework that uses the MTV framework model, namely model, view and template. Django provides a designer-friendly template language, high-quality URL design and a perfect management interface, making Django a popular web server framework for Python language, used to quickly develop and launch small and medium-sized websites.
[0003] The current working mechanism of Django is:
[0004] 1. Start the Django server with the django startup application (manage.py runserver) and load the settings.py file in the same directory. This file contains configuration information in the project, such as connection configuration (URLConf), etc. The most important configuration is ROOT_URLCONF, which determines a Python module as the URLConf of this site;
[0005] 2. When accessing the URL, Django will load the URLConf according to the setting of ROOT_URLCONF;
[0006] 3. Then match the URL patterns (URLpatterns) in URLConf one by one in order. If found, the associated view function will be called with the web page request (httprequest) object as the first parameter;
[0007] 4. Finally, the view function is responsible for returning a web page response (HttpResponse) object;
[0008] However, the above Django working mechanism has the following disadvantages:
[0009] Disadvantage 1: It is necessary to manually configure the corresponding parameters of the configuration information, and then install the configuration information into Python and its dependent packages one by one, and compress them;
[0010] Disadvantage 2: The compressed Python and its dependent packages need to be manually uploaded to the server. Considering that there is a firewall in the office network, multiple transmissions need to be made through the bastion host during the upload process.
[0011] In summary, the current Django configuration process is time-consuming and labor-intensive due to manual processing, and cannot support rapid online application deployment. Summary of the invention
[0012] In order to solve the above-mentioned technical problems, the embodiments of the present application provide a Django project deployment method, device, computer equipment and storage medium to realize automatic parameter configuration and installation and compression of Python and dependent packages, and abandon the method of uploading data by the bastion host to improve the data upload speed.
[0013] In order to solve the above technical problems, a Django project deployment method described in an embodiment of the present application adopts the following technical solution:
[0014] A Django project deployment method, including:
[0015] Respectively obtain a built-in system environment configuration and a server docking configuration of an online server, wherein the system environment configuration is a configuration environment for docking a computer device with an external device, and the server docking configuration is a configuration environment for docking an online server with an external device;
[0016] Detect mismatch configurations where the system environment configuration does not match the server docking configuration parameters through a preset py / uw test module, and / or detect missing configurations that the server docking configuration has but the system environment configuration does not have, wherein the mismatch configurations and missing configurations are configuration data that must be deployed by the computer device to dock with the online server;
[0017] Retrieve the mismatch configuration and / or missing configuration from the online server respectively through the data retrieval method preset in the py / uw test module;
[0018] Modify the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implement the deployment of the httppost interface through the modified system environment configuration;
[0019] Obtain new version data, and upload the new version data to the online server based on the deployed httppost interface, and replace the old version data with the new version data.
[0020] This application proposes a Django project deployment device, including:
[0021] An acquisition unit, respectively acquiring a built-in system environment configuration and a server docking configuration of an online server, wherein the system environment configuration is a configuration environment for docking a computer device with an external device, and the server docking configuration is a configuration environment for docking an online server with an external device;
[0022] A detection unit detects, through a preset py / uw test module, a mismatch configuration in which the system environment configuration does not match the server docking configuration parameters, and / or detects a missing configuration that the server docking configuration has but the system environment configuration does not have, wherein the mismatch configuration and the missing configuration are configuration data that the computer device must deploy in order to dock with the online server;
[0023] A retrieving unit, which retrieves the mismatched configuration and / or missing configuration from the online server respectively through a data retrieving method preset in the py / uw test module;
[0024] The docking unit modifies the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implements the deployment of the httppost interface through the modified system environment configuration;
[0025] The uploading unit obtains the new version data, and uploads the new version data to the online server by relying on the deployed httppost interface, so as to replace the old version data with the new version data.
[0026] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0027] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the Django project deployment method as described in any one of the above technical solutions are implemented.
[0028] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0029] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the Django project deployment method described in any one of the above technical solutions are implemented.
[0030] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0031] A computer device is first used to obtain the built-in system environment configuration and the server docking configuration of the online server respectively, and then the mismatch configuration of the system environment configuration and the server docking configuration parameters are detected through a preset py / uw test module, and / or the missing configuration that the server docking configuration has but the system environment configuration does not have is detected, so that the computer device identifies and determines the mismatch configuration and missing configuration that are not available for docking with the online server; then, the computer device retrieves the mismatch configuration and / or missing configuration from the online server, and modifies the system environment configuration accordingly according to the mismatch configuration and missing configuration, and implements the deployment of the httppost interface through the modified system environment configuration, so that the computer device is docked and deployed with the online server, realizes the automatic docking of the interface between the computer device and the online server, avoids unnecessary manual parameter configuration and errors, abandons the previous bastion host data uploading method, and improves the data uploading efficiency. Finally, the computer device obtains the new version data, and uploads the new version data to the online server by relying on the deployed httppost interface, and replaces the old version data with the new version data, so as to achieve the effect of quickly uploading the new version data of the Django project to the online server. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;
[0034] Figure 2 This is a flowchart of the first embodiment of the Django project deployment method described in the embodiments of the present application;
[0035] Figure 3 for Figure 2 A flowchart of a specific implementation of step S2;
[0036] Figure 4 for Figure 2 A flowchart of a specific implementation method after step S4;
[0037] Figure 5 This is a structural diagram of an embodiment of the Django project deployment device described in the embodiments of the present application;
[0038] Figure 6 It is a structural diagram of an embodiment of a computer device in the embodiments of the present application. DETAILED DESCRIPTION
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0040] It should be noted that the terms "include", "comprises" and "have" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices. In the claims, specification and drawings of the present application, relational terms such as "first" and "second" are merely used to distinguish one entity / operation / object from another entity / operation / object, and do not necessarily require or imply any such actual relationship or order between these entities / operations / objects.
[0041] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0042] In order to enable those skilled in the art to better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the relevant drawings in the embodiments of the present application.
[0043] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0044] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0045] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV), laptop computers, desktop computers, etc.
[0046] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0047] It should be noted that the Django project deployment method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the Django project deployment device is generally arranged in the server / terminal device.
[0048] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0049] The Django project deployment method proposed in this application is performed by a computer device, which uses the Django framework of Python to quickly and efficiently deploy Django project data on an online server.
[0050] Continue to refer Figure 2 , shows a flow chart of an embodiment of the Django project deployment method in the embodiment of the present application. The Django project deployment method includes the following steps:
[0051] S1, respectively obtaining a built-in system environment configuration and a server docking configuration of an online server, wherein the system environment configuration is a configuration environment for docking a computer device with an external device, and the server docking configuration is a configuration environment for docking an online server with an external device;
[0052] When the computer device receives the Django deployment instruction input by the user, it obtains the built-in system environment configuration and the server docking configuration of the online server respectively. The above Django deployment instruction is the instruction input by the user to the computer device for starting Django deployment.
[0053] S2, using the preset py / uw test module to detect mismatched configurations between the system environment configuration and the server docking configuration parameters, and / or to detect missing configurations that the server docking configuration has but the system environment configuration does not have, wherein the mismatched configurations and missing configurations are configuration data that must be deployed by the computer device to dock with the online server;
[0054] The above-mentioned py / uw test module is a test module for testing the command execution of the Python framework and the uwsgi framework of the computer device and the online server respectively. After the computer device obtains the system environment configuration and the server docking configuration, it calls the py / uw test module pre-installed in the computer device. Subsequently, the computer device uses the py / uw test module to detect the mismatch configuration that the system environment configuration does not correspond to the online server configuration parameters, and / or detects the missing configuration that the online server has but the computer device does not have. The detection process of the py / uw test module is specifically as follows:
[0055] Reference Figure 3 , for the attached Figure 2 A specific implementation flow chart of step S2;
[0056] S21, respectively obtaining a first code text and a second code text corresponding to the system environment configuration and the server docking configuration from the Django framework code storage layer of the computer device and the online server;
[0057] The computer device and the online server both have a Django framework code storage layer, in which the configuration option box for docking with external devices, the Django project execution code and other codes are recorded. The py / uw test module can locate the configuration option box of the system environment configuration and the online server configuration through a soft interface, thereby obtaining the first code text and the second code text, that is, the py / uw test module calls the preset first http download route and the second http download route, outputs the first http download route to the computer device, and enables the computer device to download a preset file. During this period, the computer device configuration option box of the system environment configuration of the computer device and the Internet response is located. Similarly, the py / uw test module outputs the second http download route to the online server to locate the server configuration option box, and finally obtains the first code text and the second code text from the Django framework code storage layers of the computer device and the online server respectively.
[0058] S22, identifying a label code of a server option box for Django deployment in the second code text;
[0059] In the code storage layer, each configuration option box has a one-to-one corresponding code, such as Div_1 and Div_2 in the html box model, which are regarded as tag codes.
[0060] S23, judging whether a computer option box for Django deployment in the system environment configuration can be located from the first code text according to the label code;
[0061] S241, if the computer option box can be located from the first code text, respectively obtain and compare configuration parameters in the server option box and the computer option box, and when the configuration parameters in the server option box and the computer option box do not match, mark the configuration parameters in the computer option box as mismatched configuration;
[0062] S242: If the computer option box cannot be located from the first code text, the label code is marked, and the system environment configuration is marked as having a missing configuration according to the mark.
[0063] The computer device obtains the first code text and the second code text of the system environment configuration and the server docking configuration, so that the computer device obtains the code text of the system environment configuration and the server docking configuration respectively. The computer device uses the code text of the server option box for Django deployment in the second code text as a label code, and can accurately locate the corresponding computer option box from the first code text. If the computer option box cannot be located through the label code, the label code is marked to mark the missing configuration in the system environment configuration according to the marked label code. If the parameters in the computer option box and the server option box do not correspond, the non-corresponding parameters in the computer option box are determined to be mismatched configurations. Finally, the computer device accurately and completely determines the mismatched configurations and / or missing configurations that the current system environment configuration needs to dock with the online server.
[0064] S3, retrieve the mismatched configuration and / or missing configuration from the online server through the preset data retrieval method in the py / uw test module;
[0065] According to the above steps S21 to S241 / S242, the computer device has obtained the mismatch configuration and missing configuration that the current system environment configuration does not have when docking with the online server through the py / uw test module. The above preset data retrieval method is as follows:
[0066] Retrieve the mismatch configuration:
[0067] The computer option box (hereinafter referred to as the first configuration option box) is matched with the server option box (hereinafter referred to as the second configuration option box), and the matching path is the above-mentioned label code. For example, if the label code of the second configuration option box is Div_1, the label code identical to Div_1 is matched according to the label codes of several first configuration option boxes, so as to realize the matching of the first configuration option box with the second configuration option box; the configuration parameters in the second configuration option box are obtained to realize the data retrieval of the mismatched configuration.
[0068] Retrieve missing configuration;
[0069] In the code storage layer of the system environment configuration of the computer device, a first virtual option box is created with a label code consistent with the label code of the second configuration option box, and matching is achieved because the label codes of the first virtual option box and the second configuration option box are consistent; the computer device obtains the configuration parameters in the second configuration option box that matches the first virtual option box to realize the retrieval of missing configuration data.
[0070] S4, modify the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implement the deployment of the httppost interface through the modified system environment configuration;
[0071] The steps for the computer device to modify the system environment configuration accordingly according to the mismatch configuration and the missing configuration are as follows:
[0072] Enter the parameters of the mismatch configuration into the corresponding computer option box;
[0073] Create a first virtual option box, enter the missing configuration parameters into the first virtual option box, and mark the first virtual option box as the system environment configuration for Django deployment.
[0074] When the computer device obtains the adaptation configuration and / or the missing configuration, the original system environment configuration of the computer device is modified; according to the matching of the first configuration option box and the second configuration option box using the label code, the parameters of the mismatched configuration in the retrieved second configuration option box are entered into the first configuration option box, thereby realizing the modification of the mismatched configuration of the system environment configuration; similarly, according to the matching of the first virtual option box and the second configuration option box using the label code, the parameters of the missing configuration in the retrieved second configuration option box are entered into the first virtual option box, thereby realizing the modification of the missing configuration of the system environment configuration; finally, through the modified system environment configuration, an httppost interface between the computer device and the online server is established to realize the deployment of the httppost interface.
[0075] The above-mentioned httppost interface is an interface called in the httppost mode. Through this interface, the computer device is connected to the online server, which abandons the previous transmission method of the bastion host and improves the data transmission efficiency.
[0076] The step of entering the parameters of the mismatch configuration into the corresponding computer option box includes:
[0077] Determine the computer option boxes for deploying the necessary configuration parameters;
[0078] When the parameters of the mismatched configuration are different from the necessary configuration parameters, a second virtual option box is established, the parameters of the mismatched configuration are deployed in the second virtual option box, and the second virtual option box is associated with the computer option box where the necessary configuration parameters are deployed.
[0079] Specifically, there is a first configuration option box in the system environment configuration of the computer device that needs to load necessary configuration parameters to ensure the operation of the machine, and the parameters of the mismatched configuration in the second configuration option box do not correspond to this part, which will result in two configuration parameters appearing when the parameters of the mismatched configuration are entered into the corresponding first configuration option box, resulting in incompatibility problems. Therefore, a deployment method is proposed:
[0080] According to the normal operation of the computer device, a first configuration option box with necessary configuration parameters is determined to be deployed, a second virtual option box with the same label code as the first configuration option box is created, the parameters of the conflicting mismatched configuration are entered into the newly created second virtual option box, and the second virtual option box is associated with the first option box according to the label code, so that the URL path of the second virtual option box is the same as that of the first option box, so as to realize the operation of the computer device locally through the conflicting first configuration option box, and when docking with the online server, the computer device can upload data to the online server through the docking of the second virtual option box.
[0081] The computer device associates the first option box with the newly created second virtual option box, so that the computer device can ensure its own operation and effectively establish a connection with the online server, thereby preventing conflicts between the necessary configuration parameters for the system environment configuration in the computer device and the mismatched configuration of the option box with the same necessary configuration parameters to be deployed.
[0082] S5, obtain the new version data, and rely on the deployed httppost interface to upload the new version data to the online server, replacing the old version data with the new version data.
[0083] When the configuration parameters in the configuration option box corresponding to the computer device and the online server match, the interface deployment in the httppost mode is realized. The computer device transmits the new version data of the Django project to the online server through the interface, and finally realizes the iteration of the Django project of the online server.
[0084] The method for a computer device to upload a Django project to an online server is as follows: the computer device replaces the original version data of the Django project with the new version data according to the URL path of the old version data, and stores the original version data on a NAS storage volume, thereby realizing the uploading of the new version data of the Django project.
[0085] In one embodiment, according to the above step S5, the computer device replaces the original version data with the new version data of the Django project according to the URL path of the old version data, and stores the original version data on the NAS storage volume, thereby realizing the uploading of the new version data of the Django project. Furthermore, according to the historical deployment information of the url_conf file in the new version data, the folder of the old version is located, and the code package and data of the new version are decompressed by tar, and the old version is archived on the NAS storage volume for subsequent rollback deployment, without manual intervention, to realize automatic replacement of the new version data.
[0086] In one embodiment, the py / uw test module includes a multivariate linear regression model, and the steps of respectively retrieving mismatch configurations and / or missing configurations from the online server through a data retrieval method preset in the py / uw test module also include:
[0087] The multivariate linear regression model executes a data retrieval method, which uses a multivariate linear regression algorithm preset in the multivariate linear regression model to determine and retrieve mismatched configurations and / or missing configurations from an online server.
[0088] Through the above steps S21 to S241 / S242, the computer device determines through the py / uw test module that the system environment configuration in the computer device does not have a mismatch configuration and / or missing configuration for docking with the online server, and the specific method of determining and retrieving the mismatch configuration and missing configuration from the online server is to use the multivariate linear regression model configured in the py / uw test module to determine and retrieve the mismatch configuration and missing configuration from the online server according to the multivariate linear regression algorithm in the multivariate linear regression model. The specific multivariate linear regression algorithm is: ;
[0089] The above-mentioned multiple linear regression model is a model for determining all server configuration parameters in the online server, and screening out mismatched configurations and missing configurations related to computer equipment from all server configuration parameters. In the above-mentioned, D1, D2, ..., Dn are mismatched configurations or missing configurations; 1 is the url path of the server docking configuration, Va1, Va2, ..., Van are the variable names in each server option box, Rv1, Rv2, ..., Rvn are the variable values in each server option box, V1, V2, ..., Vn are the view layers corresponding to each server option box; C1, C2, ..., Cn are conditional statements of each computer option box, Url1, Url2, ..., Urln are the url routes of each computer option box, and "X" is an association symbol, wherein the conditional statement is a conditional statement preset in the multiple linear regression model to prevent the configuration parameters of the computer option box and the server option box from conflicting.
[0090] Problems when retrieving mismatched configurations and missing configurations: Considering that the first configuration option box of the computer device needs to enter the necessary configuration parameters to ensure the current operation of the machine, the second configuration option box is located from the online server through the above-mentioned data retrieval method to retrieve the configuration parameters, and the configuration parameters are entered into the first configuration option box of the computer device to overwrite the necessary configuration parameters in the first configuration option box, which poses a risk of causing the computer device to crash.
[0091] In order to solve the problem of conflict between the above mismatch configuration and the original system environment configuration, a multivariate linear regression algorithm is used to locate the conflicting mismatch configuration. The specific method is as follows:
[0092] Add the configuration parameters of all the second configuration option boxes used for docking in the online server to [1, Va, Rv, V], where [1] is the URL path of each second configuration option box. Because each second configuration option box is used to dock with external devices, the URL path is consistent, that is, marked as [1]. Va1, Va2, ..., Van are the variable names recorded in each second configuration option box. Rv1, Rv2, ..., Rvn are the variable values recorded in each second configuration option box. V1, V2, ..., Vn are the view layers corresponding to each second configuration option box. Because the Django framework of the online server should have multiple view layers for later users to view and interact (the view layer is used to call out the display image to provide the Django data layer for users to view), there will be several second The configuration option box and the corresponding configuration parameters are represented by "n", and then the location of the configuration parameters of the computer device is associated with the url route of the [url class]. From the above, it can be seen that the url route of the [url class] can be a code text; it can be understood that the online server has "n" configuration parameters corresponding to the second option box, each of which corresponds to a view layer, and the computer device does not have the corresponding number of view layers, that is, the computer device is regarded as having a missing configuration, then the computer device will create a configuration option box by itself, so that [url] corresponds to [1, Va, Rv, V] one by one, and obtain the missing configuration [D] that the online server has but the computer device does not have, and retrieve the [Va] variable name and [Rv] variable value in the missing configuration [D] and enter them into the first virtual configuration option box created by itself.
[0093] The computer device compares [1, Va, Rv, V] with the configuration parameters in the first configuration option box associated with the computer device [url] to see if they are consistent, and exports the inconsistent items as the mismatch configuration [D], and enters the [Va] variable name and [Rv] variable value of the mismatch configuration [D] into the first configuration option box of the computer device.
[0094] When the first configuration option box has necessary configuration parameters for the necessary configuration, if the necessary configuration parameters of the conditional statement [C] are inconsistent with the parameters [Va, Rv] of the mismatched configuration in the corresponding position of the second configuration option box, a conflict will occur. At this time, the computer device re-establishes a new [url] to associate with a second virtual option box, and associates the newly established [url class] with the conflicting [1, Va, Rv, V] (that is, URLn+1 is associated with the conflicting [1, Va, Rv, V]), and finally, the conflicting [Va, Rv, V] is entered into the second virtual option box.
[0095] Because the second virtual option box is associated with the first option box, the second virtual option box and the first option box have the same URL path, so that the work of the computer device can be run locally through the conflicting first option box, and when docking with the online server, the computer device can upload data to the online server through the docking of the second virtual option box;
[0096] When the first configuration option box of the computer device contains configuration parameters that must be configured, if the configuration parameters are inconsistent with the configuration parameters [1, Va, Rv, V] in the second configuration option box of the online server at the corresponding position, a conflict will occur. At this time, the computer device will re-establish a second virtual option box; the configuration conflict is avoided by entering the mismatched configuration of the second option box into the second virtual option box; further, after the step of uploading the new version data to the online server through the httppost interface, the second virtual option box is deleted.
[0097] Reference Figure 4 , which is a flow chart of an embodiment of a Django project deployment method of the present application, wherein the system environment configuration is modified accordingly according to the mismatch configuration and the missing configuration, and the deployment of the httppost interface is implemented through the modified system environment configuration, after step S3, it includes:
[0098] S31, loading at least one URL path into a python framework and a uwsgi framework of a computer device and an online server;
[0099] S32, using Python's built-in urllib library to send http requests to the python framework and the uwsgi framework respectively, to obtain the html files corresponding to the python framework, the uwsgi framework and the URL path;
[0100] S33, use Python's BeautifulSoup library to parse and determine whether the HTML file is valid;
[0101] S341, if valid, it is determined that the computer equipment is connected and deployed normally with the online server.
[0102] The URL path loading in the above step S31 is achieved by directly entering the URL or importing a file that saves the URL during program interaction; in step S32, the urllib library built into the Python framework of the computer device is used to send an HTTP request to the URL and return an html file. The function of the above urllib library is to send a request to the computer device and the online server, and then obtain the html file fed back by the view layer; in step S33, Python's BeautifulSoup library is used to parse the above html file, and finally whether the interface deployment between the computer device and the online server is normal is determined by judging whether the html file is valid.
[0103] In specific implementation, for example:
[0104] Load http: / / www.******.*** / *** / ******.html. The interaction corresponding to this URL is to reset the password. Then, an HTTP request is sent. The function is for the computer device to obtain the URL path. Here, the urllib library of the online server is used to receive the feedback html file. After obtaining the html file, the computer device python's BeautifulSoup library is used to convert the html file into view layer data. Finally, it is used to identify whether the html file of the view layer data is an operation to reset the password. If so, it is determined that the computer device and the online server are connected and deployed normally. Otherwise, it is step S342, and the connection deployment is abnormal, thereby realizing the detection after the computer device and the online server httppost interface are connected, which effectively ensures that the interface is normal when uploading the Django project.
[0105] In one embodiment, the step of replacing the old version data with the new version data includes:
[0106] Test run the new version data to determine whether there are bugs;
[0107] If so, the bug context information is automatically collected and submitted to the bug database;
[0108] Retrieve the old version of data from the NAS storage volume where the old version of data is stored for rollback.
[0109] During the preset time, the new version of data is tested. During the running process, check whether there are any bug problems such as flash back, garbled view layer display, etc. If so, the bug context information is automatically collected and the currently collected bug context information is submitted to the bug database as bug information, so that programmers can handle bugs through the bug database; if a bug is detected in the new version of data, the original version of data is retrieved from the NAS storage volume on the computer device and rolled back to restore the original old version of data on the online server to ensure the normal operation of the online server.
[0110] Further references Figure 5 , Figure 5 A schematic diagram of the structure of an embodiment of a Django project deployment device in an embodiment of the present application is shown. Figure 2 The present application provides an embodiment of a Django project deployment device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0111] like Figure 5 As shown, the Django project deployment device of this embodiment includes:
[0112] Acquisition unit 1, respectively acquires a built-in system environment configuration and a server docking configuration of an online server, wherein the system environment configuration is a configuration environment for docking a computer device with an external device, and the server docking configuration is a configuration environment for docking an online server with an external device;
[0113] Detection unit 2 detects mismatched configurations of the system environment configuration and server docking configuration parameters through a preset py / uw test module, and / or detects missing configurations that the server docking configuration has but the system environment configuration does not have, wherein the mismatched configurations and missing configurations are configuration data that must be deployed by the computer device to dock with the online server;
[0114] The above-mentioned py / uw test module is a test module for testing the command execution of the Python framework and the uwsgi framework of the computer device and the online server respectively. After the computer device obtains the system environment configuration and the server docking configuration, it calls the py / uw test module pre-installed in the computer device. Subsequently, the computer device uses the py / uw test module to detect the mismatch configuration that the system environment configuration does not correspond to the online server configuration parameters, and / or detects the missing configuration that the online server has but the computer device does not have.
[0115] The above detection unit comprises:
[0116] A code acquisition module is used to acquire a first code text and a second code text corresponding to a system environment configuration and a server docking configuration from a computer device and a Django framework code storage layer of an online server respectively;
[0117] A label recognition module, used for recognizing a label code of a server option box for Django deployment in a second code text;
[0118] A label positioning module, used for determining whether a computer option box for Django deployment in the system environment configuration can be located from the first code text according to the label code;
[0119] The mismatched configuration / missing configuration marking module is used to locate the computer option box in the first code text, respectively obtain and compare the configuration parameters in the server option box and the computer option box, and when the configuration parameters in the server option box and the computer option box do not match, mark the configuration parameters in the computer option box as a mismatched configuration; when the computer option box cannot be located from the first code text, mark the label code, and mark the system environment configuration as having a missing configuration according to the mark.
[0120] A retrieval unit 3, which retrieves the mismatch configuration and / or missing configuration from the online server respectively through a data retrieval method preset in the py / uw test module;
[0121] The calling unit 3 includes:
[0122] The adaptation configuration retrieval module is used to match the first configuration option box with the second configuration option box. The matching path is the above-mentioned label code. For example, if the label code of the second configuration option box is Div_1, then the label code identical to Div_1 is matched according to the label codes of several first configuration option boxes to achieve matching; the configuration parameters in the second configuration option box are obtained to realize data retrieval of the mismatched configuration.
[0123] The missing configuration module is used to create a first virtual option box with a label code consistent with the label code of the second configuration option box in the code storage layer of the system environment configuration of the computer device, and realize the matching of the second configuration option box with the first virtual option box according to the label code just created and consistent; obtain the configuration parameters of the second configuration option box to realize the data retrieval of the mismatch configuration
[0124] The docking unit 4 modifies the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implements the deployment of the httppost interface through the modified system environment configuration;
[0125] The uploading unit 5 obtains the new version data, and uploads the new version data to the online server by relying on the deployed httppost interface, so as to replace the old version data with the new version data.
[0126] In one embodiment, the docking unit 4 comprises:
[0127] a conflicting configuration determination module, configured to determine configuration parameters that must be deployed in the first configuration option box and mismatched configuration parameters to be deployed in the first configuration option box, wherein the configuration parameters do not correspond to the parameters of the first mismatched configuration;
[0128] The virtual frame establishment module is used to establish a first virtual option frame, deploy the mismatched configuration parameters to be deployed in the first configuration option frame in the first virtual option frame, and associate the first virtual option frame with the first configuration option frame.
[0129] In one embodiment, the Django project deployment device further includes:
[0130] A URL path loading unit, used to load at least one URL path into a python framework and a uwsgi framework of a computer device and an online server;
[0131] The Html file receiving unit is used to use the built-in urllib library of Python to send http requests to the python framework and the uwsgi framework respectively, so as to obtain the html files corresponding to the python framework, the uwsgi framework and the URL path;
[0132] The file judgment unit is used to use Python's BeautifulSoup library to parse and judge whether the HTML file is valid;
[0133] The normal deployment determination unit is used to determine that the computer device is normally connected and deployed with the online server when the HTML file is valid.
[0134] In one embodiment, the Django project deployment device further includes:
[0135] New version trial run unit, trial run new version data to determine whether there are bugs;
[0136] Bug collection unit, used to automatically collect bug context information when a bug exists and submit it to the bug database;
[0137] The rollback unit retrieves the old version of data from the NAS storage volume storing the old version of data for rollback processing.
[0138] The Django project deployment device first obtains the built-in system environment configuration and the server docking configuration of the online server respectively by the acquisition unit 1, and then detects the mismatch configuration that the system environment configuration does not match the server docking configuration parameters through the py / uw test module preset in the detection unit 2, and / or detects the missing configuration that the server docking configuration has but the system environment configuration does not have; the retrieval unit 3 is used to retrieve the mismatch configuration and / or the missing configuration from the online server respectively through the data retrieval method preset in the py / uw test module; then the system environment configuration is modified accordingly according to the mismatch configuration and the missing configuration according to the docking unit 4, and the deployment of the httppost interface is realized through the modified system environment configuration; finally, the new version data is obtained through the uploading unit 5, and the new version data is uploaded to the online server by relying on the deployed httppost interface, and the old version data is replaced by the new version data, thereby realizing the rapid uploading of the new version data of the Django project to the online server, and realizing the automatic docking of the interface between the computer equipment and the online server, avoiding unnecessary manual parameter configuration and errors, abandoning the previous bastion machine data upload method, and improving the data upload efficiency.
[0139] To solve the above technical problems, the present application also provides a computer device. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.
[0140] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 6 having components 61-63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0141] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0142] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the computer device 6. Of course, the memory 61 can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as the program code of the Django project deployment method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.
[0143] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run the program code stored in the memory 61 or process data, such as running the program code of the Django project deployment method.
[0144] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0145] The computer device first obtains the built-in system environment configuration and the server docking configuration of the online server respectively, and then detects the mismatch configuration of the system environment configuration and the server docking configuration parameters through the preset py / uw test module, and / or detects the missing configuration that the server docking configuration has but the system environment configuration does not have; the mismatch configuration and / or the missing configuration are retrieved from the online server respectively through the preset data retrieval method in the py / uw test module; the system environment configuration is modified accordingly according to the mismatch configuration and the missing configuration, and the deployment of the httppost interface is implemented through the modified system environment configuration; finally, the computer device obtains the new version data, and relies on the deployed httppost interface to upload the new version data to the online server, and replaces the old version data with the new version data, thereby realizing the rapid uploading of the new version data of the Django project to the online server, and realizing the automatic docking of the interface between the computer device and the online server, avoiding unnecessary manual parameter configuration and errors, abandoning the previous bastion host data upload method, and improving the data upload efficiency.
[0146] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores a data compression program for high-frequency business data, and the data compression program for high-frequency business data can be executed by at least one processor so that the at least one processor performs the steps of the Django project deployment method as described above.
[0147] The computer-readable storage medium first obtains the built-in system environment configuration and the server docking configuration of the online server respectively, and then detects the mismatch configuration of the system environment configuration and the server docking configuration parameters through the preset py / uw test module, and / or detects the missing configuration that the server docking configuration has but the system environment configuration does not have; the mismatch configuration and / or the missing configuration are retrieved from the online server respectively through the data retrieval method preset in the py / uw test module; the system environment configuration is modified accordingly according to the mismatch configuration and the missing configuration, and the deployment of the httppost interface is implemented through the modified system environment configuration; finally, the computer-readable storage medium obtains the new version data, and relies on the deployed httppost interface to upload the new version data to the online server, and replaces the old version data with the new version data, thereby realizing the rapid uploading of the new version data of the Django project to the online server, and realizing the automatic docking of the interface between the computer-readable storage medium and the online server, avoiding unnecessary manual parameter configuration and errors, abandoning the previous bastion host data upload method, and improving the data upload efficiency.
[0148] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0149] In the above embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0150] The modules or components may or may not be physically separated, and the parts displayed as modules or components may or may not be physical modules, and may be located in one place or distributed on multiple network units. Some or all of the modules or components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0151] The present application is not limited to the above-mentioned implementation modes. The above-mentioned are the preferred implementation modes of the present application. The examples are only used to illustrate the present application and are not used to limit the scope of the present application. It should be pointed out that, for ordinary technicians in the technical field, without departing from the principle of the present application, they can still make some improvements and modifications to the technical solutions recorded in the above-mentioned specific implementation modes, or make equivalent replacements for some of the technical features therein. Any equivalent structure made by using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, shall be deemed to be included in the protection scope of the present application.
[0152] Obviously, the embodiments described above are only part of the embodiments of the present application, rather than all the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work, as well as all equivalent structures made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, are similarly within the scope of patent protection of the present application.
Claims
1. A Django project deployment method, characterized in that: include: Respectively obtain a built-in system environment configuration and a server docking configuration of an online server, wherein the system environment configuration is a configuration environment for docking a computer device with an external device, and the server docking configuration is a configuration environment for docking an online server with an external device; Detect mismatch configurations where the system environment configuration does not match the server docking configuration parameters through a preset py / uw test module, and / or detect missing configurations that the server docking configuration has but the system environment configuration does not have, wherein the mismatch configurations and missing configurations are configuration data that must be deployed by the computer device to dock with the online server; Retrieve the mismatch configuration and / or missing configuration from the online server respectively through the data retrieval method preset in the py / uw test module; Modify the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implement the deployment of the httppost interface through the modified system environment configuration; Obtain new version data, and upload the new version data to the online server based on the deployed httppost interface, and replace the old version data with the new version data; In the step of detecting the mismatch configuration in which the system environment configuration does not match the server docking configuration parameters through the preset py / uw test module, and / or detecting the missing configuration that the server docking configuration has but the system environment configuration does not have, the detection process of the py / uw test module includes: Respectively obtaining a first code text and a second code text corresponding to the system environment configuration and the server docking configuration from the Django framework code storage layer of the computer device and the online server; Identify the label code of the server option box for Django deployment in the second code text; According to the label code, determine whether the computer option box for Django deployment in the system environment configuration can be located from the first code text; If the computer option box can be located from the first code text, then respectively obtaining and comparing the configuration parameters in the server option box and the computer option box, and when the configuration parameters in the server option box and the computer option box do not match, marking the configuration parameters in the computer option box as mismatched configurations; If the computer option box cannot be located from the first code text, marking the label code, and marking the system environment configuration as having a missing configuration according to the marking; The py / uw test module includes a multivariate linear regression model, and the step of respectively retrieving the mismatch configuration and / or missing configuration from the online server by using a data retrieval method preset in the py / uw test module includes: The multivariate linear regression model executes the data retrieval method, and uses the multivariate linear regression algorithm preset in the multivariate linear regression model to determine and retrieve the mismatch configuration and / or missing configuration from the online server.
2. The Django project deployment method according to claim 1, characterized in that: The multivariate linear regression algorithm is: ; Wherein, D1, D2, ..., Dn are the mismatch configurations or the missing configurations; 1 is the url path of the server docking configuration, Va1, Va2, ..., Van are the variable names in each server option box, Rv1, Rv2, ..., Rvn are the variable values in each server option box, V1, V2, ..., Vn are the view layers corresponding to each server option box; C1, C2, ..., Cn are the conditional statements of each computer option box, Url1, Url2, ..., Urln are the url routes of each computer option box, "X" is an association symbol, wherein the conditional statement is a conditional statement preset in the multivariate linear regression model to prevent the configuration parameters of the computer option box and the server option box from conflicting.
3. The Django project deployment method according to claim 1, characterized in that: The step of modifying the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implementing the deployment of the httppost interface through the modified system environment configuration includes: Enter the parameters of the mismatch configuration into the corresponding computer option box; A first virtual option box is created, the parameters of the missing configuration are entered into the first virtual option box, and the first virtual option box is marked as a system environment configuration for Django deployment.
4. The Django project deployment method according to claim 3, characterized in that: The step of entering the parameters of the mismatch configuration into the corresponding computer option box includes: Determine the computer option boxes for deploying the necessary configuration parameters; When the parameters of the mismatched configuration are different from the necessary configuration parameters, a second virtual option box is established, the parameters of the mismatched configuration are deployed in the second virtual option box, and the second virtual option box is associated with a computer option box in which the necessary configuration parameters are deployed.
5. The Django project deployment method according to claim 1, characterized in that: After the step of modifying the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implementing the deployment of the httppost interface through the modified system environment configuration, the method further comprises: Load at least one URL path into the python framework and uwsgi framework of the computer device and the online server; Use Python's built-in urllib library to send http requests to the Python framework and the uwsgi framework respectively to obtain the HTML files corresponding to the Python framework, the uwsgi framework and the URL path; Use Python's BeautifulSoup library to parse and determine whether the HTML file is valid; If it is valid, it means that the computer equipment is connected to the online server and deployed normally.
6. A Django project deployment device, characterized in that: The Django project deployment device executes the steps of the Django project deployment method according to any one of claims 1 to 5, and the Django project deployment device includes: An acquisition unit, which respectively acquires a built-in system environment configuration and a server docking configuration of an online server, wherein the system environment configuration is a configuration environment for docking a computer device with an external device, and the server docking configuration is a configuration environment for docking an online server with an external device; A detection unit detects, through a preset py / uw test module, a mismatch configuration in which the system environment configuration does not match the server docking configuration parameters, and / or detects a missing configuration that the server docking configuration has but the system environment configuration does not have, wherein the mismatch configuration and the missing configuration are configuration data that the computer device must deploy in order to dock with the online server; A retrieving unit, which retrieves the mismatched configuration and / or missing configuration from the online server respectively through a data retrieving method preset in the py / uw test module; The docking unit modifies the system environment configuration accordingly according to the mismatch configuration and the missing configuration, and implements the deployment of the httppost interface through the modified system environment configuration; The uploading unit obtains the new version data, and uploads the new version data to the online server by relying on the deployed httppost interface, so as to replace the old version data with the new version data.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the Django project deployment method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the Django project deployment method according to any one of claims 1 to 5 are implemented.
