hostinger-django-demo/HOSTINGER_DEPLOYMENT.md
thecyberlearn f721b0a87e Add comprehensive production deployment system
- Complete deployment documentation (PRODUCTION_DEPLOYMENT.md)
- Automated deployment script (production-deploy.sh)
- Systemd service templates (socket + service)
- Production settings template with security best practices
- Nginx configuration template with performance optimizations
- Comprehensive troubleshooting guide
- Quick start guide for fast deployment

Fixes all issues encountered in initial deployment:
- Uses non-root django user for security
- Proper /var/www directory structure
- Unix socket instead of TCP for better performance
- Socket activation with systemd
- Correct virtual environment handling
- Production security headers and settings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 23:03:30 +05:30

1.7 KiB

Hostinger VPS Deployment Commands

VPS Details

Step-by-Step Deployment

1. Connect to VPS

ssh root@69.62.81.168

2. Clone Repository

cd /home/ubuntu || cd /root
mkdir -p /home/ubuntu
cd /home/ubuntu
git clone https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git django-demo
cd django-demo

3. Run Deployment Script

sudo bash deploy/deploy.sh

4. Configure Environment

sudo nano .env

Set these values:

SECRET_KEY=your-super-secret-key-change-this-to-something-long-and-random
DEBUG=False
ALLOWED_HOSTS=69.62.81.168,localhost,127.0.0.1
DATABASE_URL=postgresql://demo_user:your_secure_password@localhost:5432/demo_db
SECURE_SSL_REDIRECT=False

5. Update Nginx Configuration

sudo nano /etc/nginx/sites-available/django-demo

Replace yourdomain.com with 69.62.81.168 in the server_name line.

6. Restart Services

sudo systemctl restart django-demo
sudo systemctl restart nginx

7. Check Status

sudo systemctl status django-demo
sudo systemctl status nginx

8. Test Application

Visit: http://69.62.81.168

Troubleshooting Commands

# View Django logs
sudo journalctl -u django-demo -f

# View Nginx logs
sudo tail -f /var/log/nginx/error.log

# Restart services
sudo systemctl restart django-demo nginx

# Check if ports are open
sudo netstat -tlnp | grep :80
sudo netstat -tlnp | grep :8000

Creating Admin User

cd /home/ubuntu/django-demo
source venv/bin/activate
python manage.py createsuperuser

Access admin at: http://69.62.81.168/admin