Deploying Django on a Cloud Server Using Claude Code – My Step-by-Step Experience

Categories: DevOps & Cloud Deployment

1. Introduction: Why I used AI-assisted deployment

When I first attempted to deploy my Django website on a cloud server, I felt nervous because deployment is often the most challenging part of web development. While I understood the fundamentals, I wanted to avoid spending countless hours on manual configuration. That's when I discovered Claude Code, an AI-powered DevOps assistant designed to streamline coding and deployment tasks.

Rather than executing every command manually, I leveraged this AI deployment agent as an intelligent assistant. It automatically generated deployment steps, recommended optimized commands, helped debug errors in real-time, and accelerated the entire workflow significantly. This is my complete guide on deploying a Django application using AI automation — explained in simple, beginner-friendly terms.

If you're new to cloud server deployments or seeking a more efficient deployment workflow, this step-by-step Django deployment guide will help you master the process.

 

 

2. What I wanted to deploy (my Django website idea)

I built this Django website to share insights about technology, learning, and my professional journey in network engineering. Before deploying it to production, I thoroughly tested it in my local development environment — but that wasn't enough. I wanted to share what I know with the world, with you.

That's when I took the leap and deployed my Django blog on a cloud VPS server, making it accessible to anyone, anywhere. This marks my first attempt to share knowledge that might genuinely help you in your own tech journey.

 

3. My cloud server setup

After researching various hosting options, I chose an Ubuntu cloud VPS with 8GB RAM from Hostinger, which costs approximately $18 per month. However, if you're just starting out, a 2GB RAM VPS server is more than enough to host a blog site and will cost significantly less. Pro tip: purchasing an annual plan can significantly reduce your monthly costs and provide better value.

I accessed the server via SSH from my local machine and maintained a minimal server configuration for optimal performance. Security was a top priority, so I implemented several hardening measures including changing the default SSH port and applying additional security configurations to protect against common vulnerabilities and attacks.

For the operating system, I selected Ubuntu 22.04 LTS, though any recent Ubuntu version will work seamlessly for Django deployment. The deployment stack includes Nginx as the reverse proxy server and Gunicorn as the WSGI application server — a proven combination for production Django applications.

I also purchased my custom domain tawkirjournal.com from Namecheap, giving my blog a professional identity.

 

4. How I used Claude Code (step-by-step)

Step 1: Upload Your Django Project to the VPS

First, you need to transfer your Django project files to your VPS server. You have two main options: use GitHub for version control deployment or manually transfer files using WinSCP or FileZilla. Choose whichever method suits your workflow best.

Check: How to upload files from local server to remote server

Step 2: Set Up Claude Code on Your VPS

I purchased Claude Code Pro for $20 per month to automate the deployment process. Note that the Pro plan is required to use the Claude CLI tool. If you prefer, you can also use the Claude API key as an alternative.

Once you have access, SSH into your VPS terminal and install Claude Code. After setup, launch it by typing claude in your terminal. A prompt window will appear asking whether you want to use the $20 Pro plan or an API key — I went with the Pro plan.

Important: Always run Claude Code from within your Django project folder for best results.

Check:How to setup claude code in linux or windows

 

Step 3: Deploy with AI Automation

In the Claude Code prompt window, use a deployment instruction like this:

"You are in an Ubuntu VPS server with Django website files. You are currently in the project folder. Your job is to host this website using Nginx as a reverse proxy and Gunicorn as the WSGI server. My website domain name is 'yourwebsite.com'. The VPS server IP is xxx.xxx.xxx.xxx (replace with your actual VPS IP provided by your hosting provider)."

For hosting multiple websites on one VPS (which I recommend for cost efficiency), add this line:

"Remember, I will host multiple websites on this VPS server. Configure the settings to support multiple sites simultaneously."

Step 4: Let AI Handle the Deployment

Claude Code will automatically execute the deployment steps. It may encounter errors or request permissions — simply grant them when prompted.

Pro tip: If you encounter any errors, copy the error messages and paste them back into Claude Code with instructions to fix them. It will troubleshoot and resolve most issues automatically. Within minutes, your website will be live.

Step 5: Configure DNS Settings

Finally, log into Namecheap (or your domain registrar) and update your DNS records to point your domain to your VPS server IP address. This connects your domain name to your actual hosting server.

 

5. Commands the agent gave me

Automated Deployment with Claude Code

You don't need to type any commands or perform manual configurations. Claude Code handles everything automatically — from installing Python packages to configuring the server environment. Your only job is to grant Claude permission to execute commands when prompted.

Claude Code will automatically generate and execute commands like these:

bash

`# Install Python and essential packages:

sudo apt update && sudo apt install python3-pip python3-venv nginx -y

# Create and activate virtual environment

python3 -m venv venv source venv/bin/activate

# Install Django dependencies

pip install -r requirements.txt pip install gunicorn

# Configure Gunicorn as systemd service

sudo nano /etc/systemd/system/gunicorn.service

# Set up Nginx reverse proxy

sudo nano /etc/nginx/sites-available/yourwebsite.com

# Collect static files

python manage.py collectstatic --noinput

# Run database migrations

python manage.py migrate

# Create symbolic link for Nginx sudo

ln -s /etc/nginx/sites-available/yourwebsite.com /etc/nginx/sites-enabled/

# Test and restart services

sudo nginx -t sudo systemctl restart nginx sudo systemctl restart gunicorn`

If you provide clear instructions, Claude Code can even modify your Django settings.py file automatically — updating ALLOWED_HOSTS, configuring STATIC_ROOT, setting up database connections, and adjusting security settings for production.

The beauty of this approach? You simply supervise and approve actions while the AI handles the technical implementation.

 

 

6. Problems I faced

Common Deployment Issues and AI-Powered Solutions

Even with automation, you might encounter a few common issues. The good news? Claude Code can troubleshoot and fix them automatically when you describe the problem.

Issue 1: Static Files Not Loading

Your Django site may load but CSS, JavaScript, and images don't appear. This happens when static file paths are misconfigured. Simply tell Claude Code: "My static files aren't loading properly."

Claude will automatically update your settings.py with the correct STATIC_ROOT and STATIC_URL paths, run python manage.py collectstatic, and configure Nginx to serve static files from the right directory.

Issue 2: Nginx Default Page Instead of Your Website

Sometimes you'll see only the generic Nginx welcome page instead of your Django site. This indicates the Gunicorn service isn't running or isn't properly connected to Nginx.

Tell Claude: "The webpage shows only the Nginx page, not my actual website." Claude will check the Gunicorn systemd service status, restart it if needed, verify the Nginx configuration files, create proper symbolic links, and ensure the reverse proxy is correctly forwarding requests to Gunicorn.

Issue 3: Firewall Blocking Web Traffic

Firewall issues are critical and often overlooked. Your VPS has two firewalls: one from Hostinger's control panel and Ubuntu's built-in UFW (Uncomplicated Firewall). Both must allow web traffic.

For security best practices, you need to:

  • Allow port 80 (HTTP) and port 443 (HTTPS) in both firewalls
  • Change the default SSH port from 22 to a custom port (e.g., 2222)
  • Allow your custom SSH port in both firewalls

Tell Claude: "Configure firewall rules to allow HTTP, HTTPS, and custom SSH port." Claude will execute UFW commands and remind you to also update Hostinger's firewall settings through their dashboard.

Issue 4: Incorrect File Paths

Wrong directory paths can break the entire deployment. If Claude references incorrect project locations, simply provide the correct path and Claude will update all configuration files accordingly — including Nginx configs, Gunicorn service files, and Django settings.

Bonus: Adding HTTPS with SSL Certificate

For a production website, HTTPS encryption is essential for security and SEO rankings. Instead of manually configuring SSL certificates, simply instruct Claude: "Install and configure Let's Encrypt SSL certificate for HTTPS."

Claude Code will automatically install Certbot, obtain a free SSL certificate from Let's Encrypt, update your Nginx configuration to enable HTTPS on port 443, set up automatic certificate renewal, and redirect all HTTP traffic to HTTPS. Your website will instantly have the secure padlock icon in browsers.

How Claude Fixed Everything

Claude Code systematically diagnosed each issue, generated the appropriate fix commands, executed them with your permission, verified the results, and continued until the website was fully operational with HTTPS enabled. What would typically take hours of manual debugging and SSL configuration was resolved in minutes through conversational troubleshooting.


7. Final result

“My website was live with HTTPS, domain pointing correctly, Nginx running, and Gunicorn serving my Django app.”

8. What I learned

Why AI-Powered Deployment Changed Everything

Using Claude Code for Django deployment saved me countless hours of frustration and trial-and-error. Traditional deployment tutorials often lack crucial details about production environment configurations, leaving beginners stuck at critical steps.

The Problem with Traditional Tutorials

Most Django deployment guides I followed didn't provide clear instructions for deploying websites in a production environment. I found myself jumping between multiple blog posts and coding forums, trying to piece together a complete picture of how to actually deploy a Django website on a VPS — especially when it came to hosting multiple websites on the same server.

How AI Solved This

With Claude Code, I didn't need to waste time searching through dozens of tutorials looking for the right approach. The AI handled the technical implementation while I focused on understanding what was happening at each step. This learning-by-doing approach helped me grasp the deployment process much faster.

Beyond Django: Endless Possibilities

The best part? This approach works for any type of website. Whether you're deploying Django, React, Next.js, or any other web framework you can imagine, Claude Code can automate the process. The possibilities are truly endless.

Perfect for Beginners

AI deployment tools dramatically accelerate the learning curve for beginners. Instead of getting stuck on configuration errors for hours, you can have your website live in minutes while still understanding the underlying process. It's the perfect balance between automation and education.

9. Conclusion: Embrace AI for Smarter Deployment

If you're new to deploying Django applications or feel intimidated by cloud server configurations, I highly recommend trying AI-assisted deployment tools like Claude Code. They won't replace your technical knowledge — instead, they act as an intelligent guide that helps you learn while building.

For me, using AI transformed deployment from a stressful, time-consuming process into something easier and genuinely enjoyable. It allowed me to focus on understanding the concepts rather than fighting with syntax errors and misconfigurations.

Whether you're launching your first blog or scaling to multiple websites on a single VPS, AI can help you deploy faster, learn better, and build with confidence.