> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.elitehost.co.za/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How do I deploy a Python App in cPanel?

Python is a powerful programming language commonly used for web development, scientific computing, data analysis, and more. cPanel makes it easy to deploy Python applications through the **Setup Python App** feature, allowing you to host your Python applications without needing SSH access. Follow this guide to deploy your Python app in cPanel.

### Step 1: Create a Python Application

1. **Navigate to cPanel**: Locate and click on **Setup Python App** in the **Software** section of cPanel.
2. **Click "Create Application"**: Start the setup process.
3. **Select Python Version**: Choose your preferred Python version (e.g., 3.11).
4. **Application Root**: Specify a directory name (e.g., `python_app`) where your app files will be stored.
5. **Application URL**: Leave blank to host on the root domain, or enter a subdirectory (e.g., `myapp`).
6. **Application Startup File**: (optional) Input the main .py entry file, used to start your web application.
7. **Application Entry Point**:  (optional) Specify the name of the wsgi file for your application.

**Click "Create"** and wait for the environment to initialise.

### Step 2: Upload Your Application Files

1. **Open File Manager**: Right-click **File Manager** in cPanel and select "Open Link in New Tab" for easier navigation.
2. **Navigate to Application Root Directory**: Open the directory you set as the root (e.g., `/python_app`).
3. **Upload Files**: Add all necessary files for your app, such as `manage.py`, modules, and any configuration files (e.g., `requirements.txt`).

### Step 3: Install Dependencies

1. **Return to Setup Python App**: Go back to **Setup Python App** in cPanel.
2. **Add requirements.txt**: Under "Configuration Files," enter `requirements.txt`, then click **Add** and **Edit** to specify all dependencies.
3. **Run Pip Install**: Click **Run Pip Install** to install dependencies from `requirements.txt`.

### Step 4: Configure Environment Variables (Optional)

* If needed, click **Add Variable** under **Environment Variables**.
* Enter each **Variable Name** and **Value**.
* Click **Done** and **Save** to apply changes.

### Step 5: Start the Application

1. **Click Start Application**: Start your app using the **Start Application** button.
2. **Verify the Application**: Open the **Application URL** in your browser to check if it’s running correctly.

### Managing and Monitoring the Application

* **Error Logs**: Check the `stderr.log` file in the app root for troubleshooting.
* **Stop/Start/Restart Application**: Use the buttons in **Setup Python App** for managing your app.
* **Change Python Version**: Stop the app, select a new version, and restart if necessary.

Following these steps will enable you to deploy your Python app efficiently using cPanel without requiring SSH.

### Virtual Environment Command Line Access

If you have SSH/Terminal access through a Business or Reseller package, you can manage the app directly via the command line. Many users prefer this option for faster or more detailed control over their applications. This feature enables you to work within a secure virtual environment specifically for your app, providing convenient access to command-line tools.

1. In **Setup Python App**, click **Edit** next to your app.
2. Copy the **source** command provided next to **Enter to the virtual environment**.
3. Open **Terminal** in cPanel or log in via SSH, paste, and run the command to enter the environment.

If you need help, reach out to our [support team](https://my.elitehost.co.za/submitticket.php?step=2&deptid=14) or email helpdesk@elitehost.co.za.