Framework

Django hosting

Python web framework. Deploy to a dedicated VPS in seconds — database auto-created, SSL installed, firewall locked down from the first boot.

Python 3.11 – 3.13

Versions

SQLite / PostgreSQL / MySQL

Database

Python

Category

SSL included
Firewall locked
DB auto-created
Live in minutes
Overview

What is Django?

Django is a high-level Python web framework for building secure, database-driven web applications quickly. It includes an ORM, migrations, an admin interface, authentication, forms and templating out of the box.

Django follows a "batteries included" approach: most things a web application needs are part of the framework, and the wider ecosystem adds REST APIs, background jobs, search and more.

SharkCluster creates a Python virtual environment, installs Django, Django REST framework, django-cors-headers and Gunicorn, starts a new Django project and runs the first migrations. Gunicorn serves the project behind nginx or Apache and PM2 keeps it running after crashes and reboots.

You can also add a React frontend built with Vite. The web server then serves the React build as the site and forwards /api/ and /admin/ to Django.

Quick facts

Version
Python 3.11 – 3.13
Database
SQLite / PostgreSQL / MySQL
Category
Python
  • SSL included
  • Firewall locked
  • DB auto-created
  • Live in minutes
Why SharkCluster

Why Django on SharkCluster?

Ready-to-code project

A working Django project with migrations applied, so you can start adding apps and models immediately or replace it with your own code.

REST APIs included

Django REST framework and django-cors-headers are installed, ready for API backends and single-page apps.

Production app server

Gunicorn runs the WSGI application with multiple workers instead of Django's development server.

Process management

PM2 restarts the app if it stops and starts it again after a server reboot.

Isolated dependencies

Each app has its own virtual environment, so different projects on one server can use different package versions.

Full-stack option

Add a React frontend served by the web server with API calls forwarded to Django on the same domain.

Features

What you get with Django

  • Python virtual environment per app

  • Django, Django REST framework and django-cors-headers

  • Gunicorn WSGI server (2 workers)

  • PM2 process management and restart on reboot

  • Initial migrations applied

  • Optional React frontend built with Vite

  • nginx or Apache reverse proxy

  • Custom domain support

  • Free SSL certificate

  • SSH and SFTP access

  • Git deployment support

Use cases

What Django is built for

Web applications

Database-driven sites and internal tools with Django's ORM, forms and admin.

REST APIs

API backends for mobile apps and single-page frontends with Django REST framework.

Admin dashboards

Use the built-in Django admin to manage data without building a custom UI.

Full-stack apps

Pair Django with a React frontend on the same domain.

SaaS products

Build multi-user products with authentication, permissions and a relational database.

System requirements

Server specs for
Django

Not sure which plan to pick? The panel warns you before you deploy so you can choose the right size the first time.

  • Minimum specs shown before deploy
  • Panel blocks deploy if server is undersized
  • Upgrade path available inside the panel
Python
Python 3.11, 3.12 or 3.13.
Django
The current Django release from PyPI at install time.
Database
SQLite to start; PostgreSQL or MySQL recommended for production.
Memory
1 GB RAM minimum; 2 GB+ with a React frontend build or heavier workloads.
CPU
1 vCPU minimum; 2+ vCPU for production traffic.
Storage
10 GB+ SSD.
Architecture

How Django fits together

1

Domain

Your domain or subdomain points to the SharkCluster server.

2

Web server

nginx or Apache forwards requests to Gunicorn and, with React, serves the frontend build.

3

Gunicorn

Runs the Django WSGI application (config.wsgi) on port 8000 with two workers.

4

PM2

Keeps the Gunicorn process running and restarts it after reboots.

5

Database

SQLite by default; connect PostgreSQL or MySQL in settings.py for production.

6

React frontend (optional)

A Vite build in frontend/dist, served as static files.

Get started

After your Django deploy

  1. 1

    Create a Django application

    Select Django in the SharkCluster panel and choose the Python version.

  2. 2

    Choose a frontend

    Optionally add a React frontend that is built and served on the same domain.

  3. 3

    Connect your domain

    Point your domain to the server and enable SSL.

  4. 4

    Open the project

    Connect over SSH or SFTP. The Django project is in htdocs/backend and the virtual environment in htdocs/backend/venv.

  5. 5

    Create a superuser

    Run manage.py createsuperuser to log in to the Django admin.

  6. 6

    Deploy your code

    Replace the starter project with your own code or add Django apps to it, then restart the PM2 process.

Deployment

Ship Django your way

Install Python

Python, venv, pip and build tools are installed, plus the selected Python version where available.

Create the virtual environment

A fresh virtual environment is created in htdocs/backend/venv.

Install packages

Django, djangorestframework, django-cors-headers and gunicorn are installed with pip.

Start the project

django-admin startproject config creates the project and migrate applies the initial migrations.

Run Gunicorn

PM2 starts Gunicorn as <app>-django, bound to port 8000 with two workers.

Configure the web server

nginx or Apache forwards traffic to Gunicorn, or serves React and forwards /api/ and /admin/.

Performance

Keeping Django fast

Tune Gunicorn workers

A common starting point is (2 × CPU cores) + 1 workers; adjust for memory.

Use PostgreSQL

Move from SQLite to PostgreSQL for concurrent writes and larger datasets.

Serve static files from the web server

Run collectstatic and let nginx or Apache serve STATIC_ROOT directly.

Cache

Use Django's cache framework with Redis for expensive queries and views.

Optimize queries

Use select_related and prefetch_related to avoid N+1 queries.

Deployment checklist

Before you go live

  • Gunicorn process is running in PM2

  • Migrations are applied

  • Domain DNS points to the server

  • SSL is enabled

  • Superuser is created

  • Static files are collected and served

  • ALLOWED_HOSTS lists your domains

  • DEBUG is False in production

Production checklist

Ready your Django for launch

  • Set DEBUG = False

  • Set ALLOWED_HOSTS to your real domains

  • Move SECRET_KEY to an environment variable

  • Use PostgreSQL or MySQL instead of SQLite

  • Run python manage.py check --deploy

  • Configure STATIC_ROOT and run collectstatic

  • Set up database backups

  • Monitor the PM2 process and logs

Useful commands

Working with Django

Activate the virtual environment

Run from the application folder before using pip or manage.py.

bash
cd htdocs/backend && source venv/bin/activate

Run migrations

Apply database migrations.

bash
python manage.py migrate

Create a superuser

Create an account for the Django admin.

bash
python manage.py createsuperuser

Collect static files

Copy static files to STATIC_ROOT.

bash
python manage.py collectstatic --no-input

Check production settings

List settings that should be changed before going live.

bash
python manage.py check --deploy

Restart the app

Reload Gunicorn after code or dependency changes.

bash
pm2 restart <app>-django
Troubleshooting

Common Django issues & fixes

502 Bad Gateway

Cause
Gunicorn is not running or failed to import the project.
Solution
Run pm2 logs <app>-django to see the error, fix it and restart the process.

DisallowedHost error

Cause
The domain is not in ALLOWED_HOSTS.
Solution
Add the domain to ALLOWED_HOSTS in config/settings.py and restart the app.

CSS and images missing in the admin

Cause
Static files are not collected or not served when DEBUG is False.
Solution
Set STATIC_ROOT, run collectstatic and serve that folder from the web server.

API routes return 404 with the React frontend

Cause
With nginx, requests to /api/... reach Django without the /api prefix.
Solution
Define the API URLs in Django without the /api prefix, or change the nginx proxy_pass so the prefix is kept.

ModuleNotFoundError

Cause
A package was installed outside the app's virtual environment.
Solution
Install it with venv/bin/pip install and restart the PM2 process.
Security config

Hardened before your first request

Every deploy is locked down from boot — closed firewall, valid SSL, and restricted access by default.

  • Set DEBUG = False in production.

  • Replace the starter ALLOWED_HOSTS = ['*'] with your real domains.

  • Keep SECRET_KEY out of version control.

  • Restrict CORS to the origins that need it.

  • Keep Django and dependencies updated.

  • Use HTTPS and enable secure cookie settings.

  • Run manage.py check --deploy before each release.

Database

The data layer behind Django

SQLite to start

The starter project uses Django's default SQLite database, which is fine for development and small apps.

PostgreSQL or MySQL for production

Change DATABASES in settings.py and install the driver (psycopg or mysqlclient) in the virtual environment.

Migrations

Run manage.py migrate after every deployment that changes models.

Environment

Django environment configuration

Settings module

The project settings are in htdocs/backend/config/settings.py.

Secrets

Read SECRET_KEY, database passwords and API keys from environment variables or a .env file.

Allowed hosts

The starter project allows all hosts; set ALLOWED_HOSTS to your domains before going live.

Upgrade safely

A safe Django upgrade path

  1. 1

    Back up the database

    Take a backup before upgrading Django or running new migrations.

  2. 2

    Read the release notes

    Check Django's release notes and deprecation timeline.

  3. 3

    Upgrade in the virtual environment

    Run venv/bin/pip install -U django and test locally or on staging first.

  4. 4

    Migrate and restart

    Run migrations, then restart the PM2 process.

Take a snapshot before every upgrade so a bad release can be rolled back in minutes.

Who owns what

We manage the server, you own the store

SharkCluster manages

  • VPS infrastructure
  • Python runtime
  • Gunicorn process in PM2
  • Web server
  • SSL
  • Firewall
  • Backups where enabled

You manage

  • Django code and apps
  • Settings and secrets
  • Python dependencies
  • Database schema and migrations
  • Static and media files
  • Django upgrades

Everything below the application line — from nginx to backups — is infrastructure. Your code, content and store configuration are always yours, and you keep full SSH and root access.

FAQ

Frequently Asked Questions

The questions we hear most from people deploying Django on SharkCluster.

Contact support

A Python virtual environment with Django, Django REST framework, django-cors-headers and Gunicorn, a new Django project with migrations applied, and a PM2 process that runs Gunicorn behind nginx or Apache.

Yes. Replace the starter project in htdocs/backend with your code, install your requirements in the virtual environment, run migrations and restart the PM2 process.

The starter project uses SQLite. For production, connect PostgreSQL or MySQL in settings.py.

Yes. Choose React when creating the app. The React build is served as the site and /api/ and /admin/ are forwarded to Django.

The Python app is a general Python environment. The Django app sets up a ready Django project with Gunicorn and PM2.

Run pm2 restart <app>-django, where <app> is your application name.

One-click setup

From deploy to live in minutes

Stack configured

Runtime, process manager and config files set up for you.

SQLite / PostgreSQL / MySQL wired

Database created with a user and credentials in your config.

SSL + firewall

Free Let's Encrypt certificate and closed-by-default UFW rules.

Deploy anytime

Push with Git, or use the built-in file manager and ZIP upload.

Start your journey today

How do you start
with SharkCluster?

To start with SharkCluster, create an account and your first server on DigitalOcean, Contabo or OVHcloud — no credit card or lock-in contract is needed. Every account includes free self-hosted business apps, free local backups, unlimited migrations and a dedicated DevOps manager.

No lock-in contracts
No credit card required
Dedicated DevOps manager