Help Center/ CodeArts Deploy/ User Guide/ Creating and Deploying an Application Using a Preset Template/ Creating and Deploying an Application Using the Django Deployment Template
Updated on 2024-09-04 GMT+08:00

Creating and Deploying an Application Using the Django Deployment Template

Deploy a Django Python background application on the host and start the service.

  • Ensure that the Nginx has been installed on the target host. If the Nginx has been installed, remove the Install Nginx action from the template.
  • Ensure that the uWSGI has been installed on the target host. If the uWSGI has been installed, remove the Install uWSGI action from the template.
  • You have configured the pip and yum sources. yum and pip are used to install software. The corresponding source addresses are configured to ensure normal installation.
  • You have created a Django project and uploaded the project files to Artifact. You can use CodeArts Build to compress the Django project files and upload the package to Artifact. Then, download and decompress the package during the deployment.

The related deployment actions are as follows.

  1. Install Python.
  2. Install Django and uWSGI.
  3. Install Nginx.
  4. Start Nginx.
  5. Download the software package.
  6. Decompress the software package.
  7. Restart the uWSGI
  8. Reload the Nginx configuration file.
  9. Test services.

Table 1 describes the parameters to be set in the template.

Table 1 Template parameters

Parameter

Description

host_group

Target environment where the application is deployed.

service_port

Port number of a Django application. The default value is 8080.

uwsgi_pid_file_path

Path of the uWSGI process ID file.

uwsgi_lni_file_path

Path of the uWSGI configuration file.

package_path

Path for downloading the Django application release package to the target host.

package_name

Name of the Django application release package downloaded to the target host.

package_url

Software package download link. To obtain it, go to the Artifact > Release Repos page.