EN
Log in Create an account

How to deploy Django on Saplo (your own Python app)

A Django application needs a running gunicorn process in the background, not just a directory with files, exactly like a Next.js app on Node. On Saplo, you deploy Django as a managed service with automatic restarts, migrations, and its own Postgres database connected via `saplo.yaml`.

Grzegorz Kalmus ·

Django is a mature framework for building web applications and APIs in Python, with an ORM, migration system, and admin panel built right in. However, your Django application needs a running WSGI process (usually Gunicorn) kept in the background, not just a directory with files - exactly like Next.js needs a Node process. You can't run such a process on regular shared hosting. On Saplo, you run Django as a managed service with automatic restarts, and Nginx serves static files and media alongside it.

Who is Django on Saplo for?

Before you start the installation, check if it's the right choice for your project:

  • You have your own Django project - Saplo runs Gunicorn as a managed service, so you don't have to write the systemd config yourself.
  • API for a mobile application or a separate SPA frontend - Django Rest Framework or regular JSON views. You set up the frontend (React, Vue) separately from the same directory.
  • A project that outgrew a free Heroku, Render, or PythonAnywhere plan - You migrate the code without changes to the application itself; you only add saplo.yaml.
  • You want deployments with git push instead of manual file uploads - You connect the repository once, and Saplo automatically builds, migrates, and restarts the service.

Requirements

To run Django on Saplo, you need:

  • A Box on a L plan or higher if your project will use its own Postgres database and real traffic - a starter with SQLite will fit on a lower plan, but a production database and more traffic require extra RAM,
  • A minimum of 256 MB of free RAM and 2 GB of disk space for the application process itself (starter),
  • Python version 3.11 or 3.12 for installation from the catalog, 3.13 available for Git deployments,
  • A domain or subdomain *.saploapp.pl included with every plan,
  • A Git repository if you want to use automatic deployment (optional to start, you can also upload the application as a .zip archive via the panel).

Step-by-step installation

  1. In the Saplo panel, go to App catalog and select Django (under "Applications").
  2. Specify the Box and the application name - this will create the default subdomain <name>.saploapp.pl.
  3. Select the Python version (3.11 or 3.12, 3.12 by default) and confirm the installation.
  4. The engine creates a new Django project with an SQLite database (sufficient for starting and testing), configures gunicorn via supervisor on port 8000, and nginx proxies traffic from the domain to this port.
  5. After the installation is complete, the domain from step 2 will show a working Django skeleton - from this point on, you deploy your own project to it.

Deploy your own code via Git

  1. In the application details, find the Git / CI-CD section and click "Connect GitHub", confirm the installation of the "Saplo Deploy" app, and select the repository with your Django project.
  2. In the root directory of the repository, place the saplo.yaml file with the build command (e.g., collectstatic) and any necessary system packages (e.g., libpq-dev, if you are connecting to PostgreSQL).
  3. You can run migrations using the hooks.post_deploy: python manage.py migrate hook - it executes after the build, before the application starts, so you don't need to connect via SSH after each deployment.
  4. You set up your own PostgreSQL database as a separate application from the catalog (Databases), and when creating the Django application, you select it in the Connect to database section - the DATABASE_URL variable is automatically passed to the application process.
  5. Commit and push saplo.yaml to the production branch (by default main). Each subsequent git push builds, migrates, and restarts the service; you can see the status in the Deployments tab.

Example of a minimal saplo.yaml file for Django:

name: my-project
stack: django
runtime:
  python: "3.13"
build:
  install: pip install -r requirements.txt
  command: python manage.py collectstatic --noinput
packages:
  - libpq-dev
env:
  DJANGO_SETTINGS_MODULE: config.settings.production
hooks:
  post_deploy: python manage.py migrate
start:
  command: gunicorn config.wsgi:application
  port: 8000

Do you have your own Dockerfile in your project and prefer full control over the runtime environment? Choose the Docker stack instead of Django in the catalog - then Saplo will not perform a native build+gunicorn+nginx for /static/, but will run your image exactly as you built it.

Django on Saplo vs. alternatives

PythonAnywhere Heroku / Render Django on Saplo
Billing model CPU limit on free plan, paid higher resource usage, grows with traffic fixed Box cost
Deployments from Git limited, mostly manual upload yes, natively yes, git push to production branch
Migrations after deploy manually via console release phase in Procfile post_deploy hook in saplo.yaml
Own Postgres database separate service, additional cost separate add-on, billed separately separate application from the same catalog

Frequently Asked Questions

Is the SQLite database from the starter suitable for production? Yes, for small traffic and testing. However, for higher traffic, connect a Postgres database from the App catalog (Databases section) and select it when creating your Django application.

Do migrations run automatically with each deployment? Yes, if you add the hooks.post_deploy: python manage.py migrate hook in saplo.yaml - it executes after the build, before the application starts.

Can I have an additional process next to Django, e.g., a Celery worker? Yes, the processes field in saplo.yaml allows you to define additional processes that run alongside the main one.

What if my project connects to Postgres and needs libpq? Enter the system package in the packages section of the saplo.yaml file - it will be installed before the build.

Will I get SSL and my own Domain? Yes, the SSL certificate is automatic, and a Domain or subdomain *.saploapp.pl is included in the Price of every plan.

You can set up Django on Saplo from scratch to a working Domain in minutes, and every subsequent git push builds, migrates, and restarts the service without your intervention. If the project requires full control over the runtime environment via its own Dockerfile, you'll find the Docker stack in the same directory.

  • #Django
  • #Git Deploy
  • #Guide
  • #Python