Why Hostinger for African Deployments
When I first started deploying production apps for Ghanaian institutions, AWS and Azure felt like overkill - both in cost and complexity. Hostinger's VPS plans offer Ubuntu 22.04, SSD storage, and reasonable latency for West Africa at a fraction of the cost.
Here's my exact production setup.
Step 1: Server Prep
sudo apt update && sudo apt upgrade -y
sudo apt install python3-pip python3-venv nginx certbot python3-certbot-nginx -y
Step 2: Deploy Your Django App
# Clone your project
git clone https://github.com/yourusername/yourapp.git /var/www/yourapp
cd /var/www/yourapp
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Environment variables
cp .env.example .env
nano .env # fill in your secrets
# Collect static files
python manage.py collectstatic --no-input
python manage.py migrate
Step 3: Gunicorn Service
# /etc/systemd/system/yourapp.service
[Unit]
Description=Gunicorn daemon for YourApp
After=network.target
[Service]
User=www-data
WorkingDirectory=/var/www/yourapp
ExecStart=/var/www/yourapp/venv/bin/gunicorn
--workers 3
--bind unix:/run/yourapp.sock
yourapp.wsgi:application
[Install]
WantedBy=multi-user.target
Step 4: Nginx Config
server {
server_name yourdomain.com www.yourdomain.com;
location /static/ { alias /var/www/yourapp/staticfiles/; }
location /media/ { alias /var/www/yourapp/media/; }
location / {
proxy_pass http://unix:/run/yourapp.sock;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Step 5: SSL
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
That's it. Total time: about 25 minutes on a clean VPS. I have this scripted as a bash playbook I reuse across every client deployment.