HiBlog Hosting and cPanel HiCademy
How to Run Python on cPanel Shared Hosting Without a Terminal
- A. MounesiAuthor
- Last updated
- 7 minutesReading time
- 4,732Views
- A. Mounesi
- Last updated:
- 7 min read
- 4,732 views
Your Python project is ready: a small Flask site, a script that has to run every day or a Telegram bot. But shared hosting has no terminal, and many people assume Python scripts can only run on a VPS or a dedicated server. If your hosting runs CloudLinux and cPanel with the Setup Python App tool, you can launch your Python app without SSH, in just a few clicks!
In this guide we build a Python app in cPanel step by step, install libraries without a terminal, schedule plain scripts, and set up a Telegram bot the right way for shared hosting: with a webhook. It is written for beginners and experienced developers alike.
Short answer: in cPanel, open Setup Python App, click Create Application and choose the Python version, the app folder and its URL, upload your files with File Manager, and install libraries with requirements.txt and the Run Pip Install button. Web apps (Flask and Django) run right there; run plain scripts with Cron Jobs.
Requirements and key points for running Python scripts
- Your hosting needs CloudLinux and the cPanel control panel.
- Setup Python App has to be enabled in cPanel.
- You need access to File Manager. No SSH or terminal is required.
- Setup Python App runs apps with Python through the web server, so it is a great fit for websites and web apps (such as Flask and Django) and for Telegram bots that use a webhook. A script that has to keep running nonstop in the background belongs on a VPS.
Setup Python App options in cPanel
| Option | What it does |
|---|---|
| Python version | The app’s Python version, for example 3.12 |
| Application root | The folder that holds the app’s files, for example myapp or telegrambot |
| Application URL | The domain or subdomain and path the app runs on |
| Application startup file | The app’s main file; passenger_wsgi.py by default |
| Application Entry point | The name of the WSGI object that is run; application by default |
| Passenger log file | Path of the app’s log file (optional) |
| Environment variables | The app’s environment variables, such as an API key (optional) |
| Run Pip Install | Installs the libraries in requirements.txt without a terminal |
| Restart | Restarts the app after every change to the code or libraries |
Step by step: run a Python app on hosting without a terminal
1. Open Setup Python App in cPanel
Log in to cPanel and click Setup Python App in the Software section. If you don’t know your cPanel address, see how to log in to cPanel.

2. Create a new Python app
Click the Create Application button.

Choose the Python version; unless you have a specific reason, pick the newest one available.

- In Application root, enter the app folder’s name, for example myapp. The folder is created next to public_html, not inside it, so your code can’t be reached from the web.
- In Application URL, choose the domain or subdomain the app runs on.
- Leave Application startup file and Application Entry point empty unless you need something else, so the defaults, passenger_wsgi.py and application, are created.
- Click Create. If you now open the app’s URL in a browser, you see the test message It works!
3. Upload the project files
Go to File Manager, open the folder you entered as Application root and upload your project files. If your Flask app lives in app.py and its Flask object is called app, the whole of passenger_wsgi.py is this one line:
from app import app as applicationFor Django, give the path of your project’s wsgi.py as the Application startup file and set the Entry point to application. For more on Flask in cPanel, see how to deploy a Flask app on cPanel.
4. Install libraries with requirements.txt
- If the app needs third-party libraries, create a text file called
requirements.txtin the app folder and write one library name per line. - Go back to Setup Python App, edit the app and add requirements.txt under Configuration files.
- Click Run Pip Install to install the libraries into this app’s virtual environment (virtualenv).
flask
pyTelegramBotAPI
requestsIf you get access to the cPanel terminal later, the command that enters the app’s virtual environment is shown at the top of the same page; something like source /home/user/virtualenv/myapp/3.12/bin/activate && cd /home/user/myapp.
5. Run, test and Restart
- Open the app’s URL in a browser and check the result.
- After every code change or new library, Restart the app so the changes take effect.
- If you see an error instead of your app, the full Python traceback is in
stderr.login the app folder.
Run a plain Python script with Cron Jobs
Setup Python App runs the app when a request arrives from the web. If you have a script that should, say, build a report or refresh some data every hour, run it from cPanel’s Cron Jobs with the Python of the app’s virtual environment:
/home/user/virtualenv/myapp/3.12/bin/python /home/user/myapp/script.pyReplace user with your hosting username, myapp with the app folder and 3.12 with your Python version. Every library you installed with Run Pip Install is available to this run too.
Run a Telegram bot on cPanel shared hosting
A Telegram bot can run on shared hosting too, but with a webhook: Telegram sends every new message to your app’s URL, and the app works only at that moment. Polling, where the bot keeps asking Telegram for new messages, needs a process that runs nonstop and doesn’t survive on shared hosting. One important point: Telegram’s servers can’t be reached from inside Iran, so for a Telegram bot choose Europe as the hosting location when you order.
Sample Telegram bot code with a webhook (pyTelegramBotAPI)
import telebot
from flask import Flask, request
TOKEN = "PUT-YOUR-BOT-TOKEN-HERE"
bot = telebot.TeleBot(TOKEN, threaded=False)
application = Flask(__name__)
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to(message, "Hi! Your bot is ready.")
@application.route('/' + TOKEN, methods=['POST'])
def webhook():
update = telebot.types.Update.de_json(request.get_data(as_text=True))
bot.process_new_updates([update])
return 'ok'- Save this code as
passenger_wsgi.pyin the app folder (or replace its default content with it), and put the two linesflaskandpyTelegramBotAPIin requirements.txt. - Click Run Pip Install and Restart the app.
- Tell Telegram your app’s URL once; just open this address in a browser, with your own token and app URL:
https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://bot.example.com/<TOKEN>If the answer is "ok":true, you are done: send /start to your bot in Telegram and it replies. The app’s URL must use HTTPS with a valid SSL certificate; see how to install SSL in cPanel.
FAQ and troubleshooting
Why does installing libraries fail?
Spell the library names in requirements.txt exactly and check that they support the app’s Python version. The hosting disk must not be full either. Some libraries have to be compiled during installation and won’t install on shared hosting; those need a VPS.
I get ModuleNotFoundError. What should I do?
Did you click Run Pip Install after adding requirements.txt? The file has to be in the same app’s folder. Restart the app after installing, too.
My Telegram bot doesn’t answer. Where is the problem?
First open https://api.telegram.org/bot<TOKEN>/getWebhookInfo; if something went wrong, Telegram shows the last error there. Then read stderr.log in the app folder and check that the hosting is located in Europe.
When do I need a VPS?
When the app has to keep running in the background (such as a polling bot or a queue worker), needs libraries that won’t install on shared hosting, or uses more resources than the hosting plan allows. To get started, see how to set up and use a VPS.
Python hosting from HiData
HiData’s professional cPanel hosting and high-traffic hosting both run Python, so you can pick either one as your Python hosting. If you are launching a site, a web project or a Telegram bot in Python, just order one of these plans and choose the location that suits your project. Enjoy coding on HiData’s powerful hosting!


