Deploying Django (and other Python apps)

Updated 14 Nov 2026 Published

Deploying Django (and other Python apps)

VinzaPanel runs Python web apps — Django, Flask and FastAPI — with the Python Deploy app. It creates a virtual environment, runs your app as a systemd service under the site owner's Linux user, and puts your web server (Nginx, Apache2 or OpenLiteSpeed) in front of it as a reverse proxy.

Before you start

  • Install Python Deploy: tick it in the first-login setup wizard, or install it from the Vinza Store (top bar). The Python option of the Create Website form appears once it is active.
  • Administrators get Server → Python (/apps/python-deploy/) to manage Python versions, and set resource limits per app.
  • A website owner can deploy their own Python site (within the Python versions the administrator has installed). Everything they do is limited to their own site and runs as their account.
Note

When you pick a remote node in the Create Website form, the app runtimes (Python, Node.js, Go, Proxy) are disabled there. A hosting account that lives on a node is different: its Python websites are created on that node, and Python Deploy runs every step (virtualenv, systemd unit, web-server rules) on that node.

Step 1: Create the website

  1. Go to Server → Websites and create a new website.
  2. As runtime choose Python, then pick the Python framework (Django, Flask or FastAPI) and the Python version.
  3. Leave Create virtual environment ticked to get a dedicated .venv with the framework pre-installed. Tick Create project skeleton if you want a starter project (it needs the virtual environment, so that is created too). For Django, the site's hostnames are added to ALLOWED_HOSTS.
  4. Save. You land on the app's deploy page, where a Quick start card runs the requested setup: press Run now (or Skip). The site shows a holding page until the app is deployed.

Create Website form with the Python runtime selected, Django as the framework and the Python version

Step 2: Upload your code

Put your project in the site's directory, /home/<user>/web/<domain>, using Git Manager, the File Manager, or SFTP/FTP — or link the repository on the deploy page's Git tab (see below). Then add your dependencies:

  • Open the site's deploy page: Websites → your site → tab Overview → Extensions → Python Deploy.
  • On the Setup tab, the Virtual environment card takes your packages in requirements.txt format. Press Set up virtualenv the first time, and Apply requirements after that. This runs pip install and can take a few minutes.

Step 3: Deploy

On the Deployment tab:

  1. Choose the Application server:
    • Gunicorn — Django / Flask (WSGI)
    • Uvicorn worker — FastAPI (ASGI)
    • Daphne — Django Channels (ASGI)
  2. Check the WSGI module or ASGI module. It is auto-detected from your project and can be edited, for example myproject.wsgi:application.
  3. Set the number of Workers (up to 5) and the Port. Leave the port on 0 and a free one is chosen for you (10000–30000). A port you type yourself must be between 1024 and 65535 and not used by another app.
  4. Press Preview service to see the systemd unit that will be written, then Deploy.

On deploy the unit is written, systemd is reloaded, and the service is enabled and started. If the service then fails to start, the deploy says so. The service is named vp-python-<domain>, with every character that is not a letter or digit replaced by a dash (for example vp-python-example-com).

Python Deploy page of a new site with the Quick start, Virtual environment and requirements steps

Step 4: Django checklist

Run the usual Django steps inside the virtual environment (for example over SSH, logged in as the site's user):

cd /home/<user>/web/<domain>
source .venv/bin/activate
python manage.py migrate
python manage.py collectstatic --noinput

If you deploy from Git, put these in the Post-deploy commands instead, so they run on every deploy.

Then, under Configuration → Static (Static & Media), point URL prefixes such as /static/ and /media/ at their folders on disk so the web server serves them directly, and press Save aliases. Keep Directory indexing off for production.

Remember to set DEBUG = False in production and enable HTTPS for the site (see SSL & HTTPS with Let's Encrypt).

Running the app

  • Start/Stop and Restart are at the top of the deploy page; Reload and Logs are on the Deployment tab. Only Gunicorn reloads in place; for the other servers Reload restarts the app.
  • Logs shows the Gunicorn access and error logs, kept in the owner's ~/logs folder (<domain>-gunicorn-access.log and <domain>-gunicorn-error.log).
  • After uploading new code by hand, restart the app so it loads the change. A Git deploy restarts it for you.
  • Edit settings reopens the deploy form with the current settings (server, module, workers, port); press Save & re-deploy. Re-deploying keeps the current port; tick Pick a new free port instead to get a new one.
  • Remove deletes the systemd service and the web-server config of the deployment, together with its environment file, deploy state and log files.

Configuration

The Configuration tab has these sections:

  • Environment — environment variables for the app (Add variable, Save variables). They are stored in a file only the site's account can read and loaded by systemd; values are hidden after saving. PORT is set by the panel. Tick Restart the app after saving to apply them at once.
  • Worker — a Background worker: a Celery, RQ or similar command run as its own service next to the app, as the site's account and with the app's environment variables. It has its own start, stop, restart and logs, and is restarted on every Git deploy.
  • Limits — Resource limits set by an administrator: a soft and a hard memory limit and a CPU quota for the app and for its worker, and for Gunicorn Recycle workers after (with Jitter), Threads per worker and Preload the app (--preload). A new deployment recycles its workers after 1000 requests (jitter 100). The website owner sees the limits read-only.
  • File Manager and Info — the app folder in the File Manager, and the app's path, user, Python version, service and port.

Deploy from Git

The Git tab deploys the app straight from a repository:

  1. Enter the Repository URL and Branch and press Link repository. Use https:// for public repositories, or git@host:owner/repo.git with the deploy key for private ones (Generate deploy key; it is the site account's key, shared with Git Manager). Credentials in the URL are not accepted.
  2. Optionally add Post-deploy commands (migrate, collectstatic, …) and press Save commands.
  3. Press Deploy now. The branch is fetched and the app folder reset to it (local changes to tracked files are discarded), the virtualenv is created if missing, requirements.txt is installed, your commands run, and the app is restarted. Every step runs as the site's account and its output goes to the deploy log.
  • Push to deploy gives the app its own webhook URL and HMAC secret for GitHub, GitLab or Bitbucket. Unsigned requests are refused and only pushes to the linked branch deploy.
  • Releases lists the recent deploys; you can Roll back to one of the last 5 successful ones. A rollback checks that commit out again, reinstalls the requirements, runs the post-deploy commands and restarts the app. Database migrations are not reversed.

Python versions

On the Server → Python page, Python runtimes lists the interpreters installed on the server. Use Install a version to add another (on Ubuntu, non-default versions come from the deadsnakes PPA). The Updates card shows installed versions that are behind their repository and updates them; running apps pick up an update after a restart. Apps choose their version when their virtualenv is created; the system default cannot be removed.

Warning

Uninstalling Python Deploy leaves deployed apps running on purpose. Remove each deployment first if you want them gone. Deleting a website stops and removes its app service automatically.

On this page