This guide will walk you through the process of setting up a Python application in cPanel, either via the graphical interface or the command line.
Note: Python applications in cPanel are available for users with shared hosting or reseller hosting plans. If you are a managed VPS hosting customer, a CloudLinux license is required.
Steps to set up a Python application in cPanel:
- Log in to cPanel.
- Find the “Software” section and click on the “Setup Python App” icon.
- On the Python selector page, click the “Create Application” button.
- Fill Out the application setup form:
- Python version: Select the Python version your application will use.
- Application root: Specify the directory where your application files will reside.
- Application URL: Provide the URL to access your application.
- Application startup file: Enter the path to the wsgi.py file (or equivalent startup file).
- Application Entry point: Leave this blank unless your application requires a specific value. cPanel will populate this automatically.
- Passenger log file: You can define the path along with the filename.
- Create the Application
Click CREATE to complete the setup. Once done, a command will be displayed to activate the virtual environment. This is beneficial for executing commands manually through SSH or the terminal in cPanel. - Click Run Pip Install to install any dependencies required by your application.
- Set up environment variables (Optional):
- Click “Add Variable” to define the name and value of any additional variables.
- After entering the details, click “Done” to save the variable.
- Save and Restart Your Application:
- Ensure everything is set up correctly.
- Click “Save” and “RESTART” to finalise your application setup.
That’s it! You have successfully set up a Python application using cPanel. You can now start building and managing your Python-based projects with ease.