Log in to cPanel.
In the SOFTWARE section of cPanel, click on the Setup Python App icon
On the Python selector page, click on the Create Application button to start the application setup.
Fill in the required fields on the application setup form.
-
Python version: Python version that your app will use to run and install dependencies.
- Application root: The directory path where all app files will reside.
- Application URL: the URL to enter in the browser to visit the app.
-
Application startup file: The Path to wsgi.pg file. It must be specified as a filename.
- Application Entry point: Setup wsgi callable object for your application. In some cases,
apps may not run properly when the main application variable is called app. This is because
WSGI software that we use to run Python on our servers requires the main application variable
to be called application. - Environment Variables: Optionally you can add environment variables to your application.
After you are done, click “CREATE” to finish setting up the app.
You have the command necessary to enter your virtual environment at the very start. This is useful when
you need to manually execute some commands either via SSH or with the terminal menu in cPanel.
Click Run Pip Install to install your app dependencies
You can additionally set up Environment variables:
Click Add Variable and you will be able to set up the Name and Value of the variable in question. After
you have entered the correct data, click Done to create the variable.
When everything is done, Save and RESTART your app.