Where can you host a Python app in India?
Host a Python app in India on a Linux KVM VPS with full root, where Django, Flask or FastAPI runs as its own long-lived process behind Nginx. A RapidServer VPS starts at ₹581/mo plus 18% GST in Mumbai (BOM1) or Delhi NCR (DEL1). Light apps can also run on cPanel web hosting; anything long-running or heavy belongs on a VPS.
cPanel web hosting vs VPS for Python apps
Both can run Python, but they suit different jobs. Our FAQ says shared plans support Python apps through cPanel's application manager for light workloads, and that long-running or resource-heavy apps belong on a VPS. For exact Python versions on a web plan, ask sales before you buy.
| cPanel web hosting | KVM VPS | |
|---|---|---|
| Good for | A small, light Python app or a first project | Django, Flask or FastAPI in production, APIs, workers, bots |
| How the app runs | Through cPanel's application manager | Your own Gunicorn or Uvicorn process under systemd |
| Root access | No | Full root |
| Install any package or database | Within the plan's limits | Yes: PostgreSQL, Redis, Celery, anything apt or pip can install |
| Server management | The host looks after the server | You, or managed support |
| Starts from | See web hosting | ₹581/mo plus 18% GST |
Rule of thumb: start on web hosting only if the app is small and you want no server to look after. Move to a VPS when you need background workers, a database of your own, WebSockets or full control. For a general comparison, read shared vs VPS vs dedicated.
Step 1: Python virtual environment on the VPS
Order a Linux VPS (Ubuntu VPS in India); it is usually ready a few minutes after payment. Log in over SSH (SSH kya hai), keep one virtual environment per app, as the venv documentation shows, and install your dependencies inside it. On Ubuntu, python3-venv may need installing first:
sudo apt update sudo apt install python3-venv cd ~/my-app python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
Pin versions in requirements.txt so the server matches your laptop. Keep secrets in environment variables or a .env file with chmod 600 .env, never in git.
Step 2: Gunicorn for Django and Flask, Uvicorn for FastAPI
Never serve production traffic with the framework's development server. Use an application server:
- Django and Flask (WSGI): Gunicorn, as in its deployment guide. Install it in the venv with
pip install gunicorn. - FastAPI (ASGI): Uvicorn, started through the
fastapicommand or directly, as the FastAPI deployment docs show. Install it withpip install "uvicorn[standard]".
Test each command by hand before you write a service file:
# Django (project folder "mysite") gunicorn mysite.wsgi # Flask (file app.py with an object named app) gunicorn -w 3 app:app # FastAPI (file main.py with an object named app) fastapi run main.py --host 127.0.0.1 uvicorn main:app --host 127.0.0.1 --port 8000
Do not use --reload in production; FastAPI's docs say it uses more resources and is less stable, and it is meant for development only.
Step 3: Keep it running with systemd
A systemd service starts your app on boot and restarts it if it stops. This follows the unit examples in Gunicorn's deployment guide, with the paths changed to your venv. Replace deploy with your Linux user and mysite.wsgi with your own module. Create /etc/systemd/system/gunicorn.socket:
[Unit] Description=gunicorn socket [Socket] ListenStream=/run/gunicorn.sock SocketUser=www-data SocketGroup=www-data SocketMode=0660 [Install] WantedBy=sockets.target
Then /etc/systemd/system/gunicorn.service:
[Unit] Description=gunicorn daemon Requires=gunicorn.socket After=network.target [Service] Type=notify NotifyAccess=main User=deploy Group=deploy WorkingDirectory=/home/deploy/my-app ExecStart=/home/deploy/my-app/.venv/bin/gunicorn mysite.wsgi ExecReload=/bin/kill -s HUP $MAINPID KillMode=mixed TimeoutStopSec=5 PrivateTmp=true [Install] WantedBy=multi-user.target
Enable the socket and check the app answers over it:
sudo systemctl daemon-reload sudo systemctl enable --now gunicorn.socket sudo systemctl status gunicorn.socket curl --unix-socket /run/gunicorn.sock http://localhost/
For FastAPI, skip the socket and use a plain service named fastapi.service whose ExecStart is /home/deploy/my-app/.venv/bin/uvicorn main:app --host 127.0.0.1 --port 8000, with the same [Install] section; start it with sudo systemctl enable --now fastapi. Read logs with journalctl -u gunicorn.
Step 4: Nginx reverse proxy and free HTTPS
Keep the app on a socket or 127.0.0.1, and let Nginx take ports 80 and 443. Run sudo apt install nginx and create /etc/nginx/sites-available/example.com, using the proxy headers from Gunicorn's guide:
server {
listen 80;
server_name example.com;
location /static/ {
alias /home/deploy/my-app/static/;
}
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://unix:/run/gunicorn.sock;
}
}
For FastAPI, use proxy_pass http://127.0.0.1:8000; instead. Link the file into sites-enabled, run sudo nginx -t and reload Nginx. Open only SSH, 80 and 443 in the firewall (firewall guide), point the domain's A record at the VPS IP, then add free HTTPS with Certbot as in our Node.js hosting guide.
Django production checklist
Django has its own deployment checklist. The essentials:
- SECRET_KEY: a large random value, kept secret and read from the environment, not committed to git.
- DEBUG: never enable it in production; it leaks source and settings.
- ALLOWED_HOSTS: set it to your domain, as Django does not work with
DEBUG = Falsewithout it. - STATIC_ROOT: define it and run
python manage.py collectstatic, then point Nginx's/static/at that folder.
Run the automated checks against your production settings before going live:
python manage.py check --deploy python manage.py collectstatic python manage.py migrate
Use PostgreSQL for a real Django site; our PostgreSQL hosting guide covers it. Containers instead of a venv? See Docker hosting in India.
Updates, backups and logs
Take a snapshot before a risky change, then pull, install, migrate and restart:
cd ~/my-app git pull source .venv/bin/activate pip install -r requirements.txt python manage.py migrate sudo systemctl restart gunicorn
Skip the manage.py line for Flask or FastAPI, and restart your own service name. Every RapidServer VPS gets daily backups kept for 7 days plus snapshots on demand; take your own database dumps and copy them off the server as well (VPS backup guide).
Which VPS plan to pick for Python
- Stardust (2 vCPU, 4 GB RAM, 20 GB NVMe, ₹581/mo): one small Flask or FastAPI app, a bot or a staging copy.
- New Moon (2 vCPU, 4 GB RAM, 40 GB NVMe, ₹674/mo): a Django site with room for uploads and logs.
- Full Moon (4 vCPU, 8 GB RAM, 160 GB NVMe, ₹1,723/mo): production with PostgreSQL, Redis and several workers.
Watch memory and CPU in the client area, and move up when they say so; billing is monthly plus 18% GST. Pick Mumbai or Delhi NCR by where your users are (data centers); Noida is served from DEL1. Support works 24/7; managed support adds ₹1,499/mo (managed vs unmanaged). More developer setups are in VPS for developers.
Dedicated vCPU, NVMe and full root in Mumbai or Delhi NCR, ready a few minutes after payment, from ₹581/mo.
See VPS plansQuestions
Can I host Python on cPanel web hosting?+
Which hosting is best for Django in India?+
Do I need Gunicorn, or can I run python manage.py runserver?+
runserver is the development server and is not meant for production. Run Gunicorn under systemd and put Nginx in front.How do I deploy FastAPI on a VPS?+
fastapi run main.py --host 127.0.0.1 (plain fastapi run listens on 0.0.0.0, every network interface), then run Uvicorn on 127.0.0.1:8000 as a systemd service. Put Nginx in front and add free HTTPS with Certbot. Skip --reload in production.