Table of Contents
What you will read?
- 1 Refresh Ubuntu 25.10 packages
- 2 Install Python, pip, and venv
- 3 Create a project directory and virtual environment
- 4 Upgrade pip and install Django
- 5 Verify Django is available
- 6 Create a new Django project
- 7 Migrate the database and run the development server
- 8 Open the firewall for port 8000
- 9 Create a Django superuser (optional)
- 10 Production option: Gunicorn + Nginx
Deploying Django on Ubuntu 25.10 is fast when you use a Python virtual environment and pip. The steps below install the latest Django, create a clean project, run the development server, and optionally wire Gunicorn with Nginx for production-grade serving on a VPS or cloud instance.
Refresh Ubuntu 25.10 packages
Pull the newest security and feature updates to keep dependencies consistent.
sudo apt update
sudo apt -y upgrade
Install Python, pip, and venv
Install Python 3, the virtual environment module, and build tools required by many Python wheels.
sudo apt install -y python3 python3-venv python3-pip python3-dev build-essential
Create a project directory and virtual environment
Keep project files isolated and reproducible with a venv scoped to your app.
mkdir -p ~/apps/mydjango
cd ~/apps/mydjango
python3 -m venv .venv
source .venv/bin/activate
python -V
Python 3.x.x
Upgrade pip and install Django
Upgrade the packaging toolchain, then install the latest stable Django. Gunicorn is added for a production-ready WSGI server.
python -m pip install --upgrade pip setuptools wheel
pip install "Django>=5.1,<6" gunicorn
Verify Django is available
Confirm the installation and record the exact version for your notes or CI.
python -m django --version
pip show Django | awk '/Version|Location/'
5.1.x
Version: 5.1.x
Location: /home/ubuntu/apps/mydjango/.venv/lib/python3.x/site-packages
Create a new Django project
Generate a minimal project with manage.py at the repository root for simpler commands.
django-admin startproject config .
ls -al
.
├── manage.py
└── config
├── __init__.py
├── asgi.py
├── settings.py
├── urls.py
└── wsgi.py
Migrate the database and run the development server
Create the default SQLite schema and start the server bound to all interfaces for testing.
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
Open the firewall for port 8000
Allow HTTP traffic to the development server if UFW is enabled.
sudo ufw allow 8000/tcp comment "Django dev"
sudo ufw status
Create a Django superuser (optional)
Access the admin panel at /admin with credentials you set now.
python manage.py createsuperuser
Production option: Gunicorn + Nginx
Serve Django via Gunicorn behind Nginx. Replace ubuntu and paths to match your user and project location. Ensure ALLOWED_HOSTS in config/settings.py includes your domain or server IP.
sudo apt install -y nginx
# Collect static files if you use STATIC_URL/STATIC_ROOT
python manage.py collectstatic --noinput
# Systemd service for Gunicorn (socket-based via UNIX file)
sudo tee /etc/systemd/system/gunicorn-mydjango.service > /dev/null <<'EOF'
[Unit]
Description=gunicorn daemon for mydjango
After=network.target
[Service]
User=ubuntu
Group=www-data
WorkingDirectory=/home/ubuntu/apps/mydjango
Environment="PATH=/home/ubuntu/apps/mydjango/.venv/bin"
ExecStart=/home/ubuntu/apps/mydjango/.venv/bin/gunicorn --workers 2 --bind unix:/run/gunicorn-mydjango.sock config.wsgi:application
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now gunicorn-mydjango
sudo systemctl status gunicorn-mydjango --no-pager
sudo tee /etc/nginx/sites-available/mydjango.conf > /dev/null <<'EOF'
server {
listen 80;
server_name _;
access_log /var/log/nginx/mydjango.access.log;
error_log /var/log/nginx/mydjango.error.log;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
alias /home/ubuntu/apps/mydjango/static/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn-mydjango.sock;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/mydjango.conf /etc/nginx/sites-enabled/ || true
sudo nginx -t
sudo systemctl reload nginx
If you see 502 errors, check permissions on the socket, verify Gunicorn is running, and review Nginx and Gunicorn logs. That’s it: Django runs on Ubuntu 25.10 with a clean venv, and production can be enabled via Gunicorn and Nginx. For more reading, guidance, purchasing various servers, and support, you can use dropvps. For more guides, visit dropvps.com
Follow DropVPS on Google
Add DropVPS as a preferred source to see our latest VPS guides and tutorials surfaced first in Google Search and AI Overviews.
Need a Linux Server for This?
Run Debian, Ubuntu, or any Linux distro on DropVPS — fast NVMe SSD, full root access, and 24/7 support. Perfect for everything you just read.
- Full Root Access
- Debian & Ubuntu Ready
- 99.99% Uptime
- 24/7 Support
No commitment · Cancel anytime
