How to Create a Python App in cPanel

1.To create a Python app in cPanel, you would start by logging into cPanel.

2. In the Software section click on "Setup Python App".
blobid0.png

blobid1.png

3. Click the "Create Application" button to configure the settings for your new app.

4. You can choose between versions of the Python language - either 2.7.18, 3.5.9, or 3.7.8 - by clicking on the blue dropdown arrow.

blobid2.png

5. Choose the Application URL and Application root directory where your Python files will live. Note, you cannot use public_html for the Application root directory, so it should be a new folder or an existing sub-directory.

6. You can add Environment variables before creating your application by clicking "Add Variable" near the bottom of the screen.

blobid3.png

Each variable must have a name and a value. In the example below, the name is x and the value is 5, so x=5 would be the variable created.

blobid4.png

Click "Done" to save any added environment variables.

 

7. Click Create when you are ready to create your Python app. The creation process may take a minute or two.

8. When you are finished you will be given a terminal command at the top of the screen similar to:

source /home/reselle1/virtualenv/app/2.7/bin/activate && cd /home/reselle1/app

blobid6.png

 

9. At this point you can cancel, stop, restart, or destroy your Python app from this screen.
blobid5.png

10. To enter the Python virtual environment, enter the terminal command into a Terminal within cPanel. To get there, click: blobid7.png near the top left of the screen then click: blobid8.png

11. Once you have entered the command similar to source /home/reselle1/virtualenv/app/2.7/bin/activate && cd /home/reselle1/app

you can just type the command: python  to be entered into a Python shell/interpreter to enter Python code.

blobid10.png

12. You can load your Python app in a web browser by going to http://yourapplicationurl.com/pythonfoldername

 

NOTE: Python app development is outside our scope of support. Like any development project, you would need to refer to Python documentation or your own developer for assistance debugging any applications. To learn more about Python you can go to: https://www.python.org/about/gettingstarted/

 

 

Was this article helpful?
0 out of 0 found this helpful