At a glance
Environment variables
DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME and DB_PASSWORD, which the project doesn’t read.
Before you begin
- A Sevalla company with a payment method, and a GitHub, GitLab or Bitbucket account for the repository. See Git providers.
- Python 3.12 or later on your computer. Django 6.1 needs Python 3.12 or later.
Create the project
Create a virtual environment, install Django and the packages the project needs in production, and start a project namedstorefront:
.env. Sevalla doesn’t use this file: you set the production values as environment variables.
Prepare the project for Sevalla
Read settings from environment variables
Instorefront/settings.py, replace everything from from pathlib import Path to ALLOWED_HOSTS = [] so that the secret key, debug mode and hosts come from the environment:
DATABASES setting:
DEBUGisFalseunless you set it.DB_URLis the variable Sevalla adds when you connect the database. django-environ accepts thepostgres://URL that Sevalla generates. WithoutDB_URL, the project uses SQLite locally.- Django sees HTTPS requests as secure without
SECURE_PROXY_SSL_HEADER: Ingot’s image trusts theX-Forwarded-Protoheader that Sevalla’s proxy sets (see proxy headers). Form posts on the application’s own domains, such as the admin’s sign-in, pass Django’s CSRF check withoutCSRF_TRUSTED_ORIGINS.
Serve static files with WhiteNoise
Add WhiteNoise right afterSecurityMiddleware:
STATIC_URL with where Django collects static files and how it stores them:
STATIC_ROOT, Ingot runs python manage.py collectstatic --noinput during the build, so the files are part of the image. WhiteNoise compresses them and gives them hashed names, so browsers and the Sevalla CDN can cache them for a long time.
Pin the Python version
Ingot builds on Python 3.14, its default line, unless the project sets a version. Django 6.1 supports Python 3.12 to 3.14. Pin 3.14 in.python-version, so the build doesn’t change when a new Ingot release moves its default line:
List the dependencies
Ingot installsrequirements.txt with pip, into a virtual environment at /app/.venv that’s on the PATH:
How Ingot builds and starts the project
The project needs no build or start configuration. Ingot findsmanage.py and Django in requirements.txt, and then:
- Installs the dependencies and runs
collectstatic. IfSECRET_KEYisn’t available during the build, Ingot sets a placeholder forcollectstaticonly, which doesn’t use it. - Starts the web process with
gunicorn -c /etc/ingot/gunicorn.conf.py storefront.wsgi:application. Gunicorn listens on the port in thePORTenvironment variable, which Sevalla sets to the web process’s port (8080by default). - Doesn’t run migrations. A job runs them once per deployment, before the new version starts.
WEB_CONCURRENCY environment variable to the number of worker processes, for example 2: Gunicorn reads it at start. To run another server or other options, see Set the start command.
Commit everything and push it to your Git provider:
Deploy to Sevalla
These steps build with Ingot. To build from your own Dockerfile instead, see Deploy with a Dockerfile.Create the database
orders-db as the Display name, choose a Data center and a Size, then click Create database. See Create a database for every field.Create the application
Connect the database
orders-db as the Service, turn on Add environment variables to the application, and click Add internal connection. Sevalla adds DB_URL and the other connection variables to the application. See Connect an application.Add the environment variables
DEBUG: it defaults to False.Create the migration job
Migrate as the Name and python manage.py migrate --noinput as the Custom start command. Keep the Start policy at Before deployment and the Resource at H1, then click Create process.Deploy
Turn on auto-deploy


Verify the deployment
-
On the Deployments tab, wait for the deployment’s status to change to Deployed. The application’s status next to its name changes to Running. Open the deployment to read its build log. Ingot’s build plan comes first:
Later, the build log showsBuild log
collectstaticcopying the static files to/app/staticfiles, and, during the rollout,Migrate has been successful. If the job fails, the deployment fails and nothing changes for visitors. See Read the build plan. With the API, Get deployment (getDeploymentV3) returns the status,successfor Deployed, and Get application deployment logs (getApplicationDeploymentLogsV3) returns the build log, whichsearchfilters.APP_IDandDEPLOYMENT_IDcome from Deploy with the API: -
Click the domain under the application’s name, then add
/admin/to the address. Django’s admin sign-in page opens with its styles, which shows that WhiteNoise serves the static files. The site root returns404until you add your own URLs, because the welcome page only shows withDEBUGon. From a shell, with your application’s domain: -
To sign in to the admin, create a superuser. Click the Web terminal tab, and in the shell that opens in the Web process, run:
Ingot puts the virtual environment’s
binfolder on thePATH, sopythonis the project’s Python with its packages. See Web terminal.createsuperuserasks for a password, so it needs the terminal. A script or an AI agent can run a command that doesn’t ask anything with Run a command in a process (execProcessCommandV3).migrate --checkexits with0when every migration has run:CLI:sevalla apps processes exec "$WEB_ID" --app-id "$APP_ID" -- python manage.py migrate --check. MCP:sevalla_api_updatewithexecProcessCommandV3.
Deploy with a Dockerfile
Ingot needs no Dockerfile. Write your own when you want full control of the image: the base image, the system packages and every layer. Add aDockerfile and a .dockerignore to the root of the repository:
Dockerfile, so you can keep it in a repository that builds with Ingot, but it adds the .dockerignore patterns to its own: its build plan shows an Ignored row with 8 patterns from .dockerignore. Then switch the application to the Dockerfile build strategy:
Choose the Dockerfile build strategy
Dockerfile and the Docker context ., then click Update build strategy.Deploy


📦 Building and pushing docker image using Dockerfile... where Ingot’s build plan was, then Migrate has been successful: the job runs python manage.py migrate --noinput in the new image. The admin at /admin/ opens with its styles, signing in works as before, and the deployment’s Dockerfile tab shows your Dockerfile. See Dockerfile.
Deploy changes
With Auto-deploy on, every push to the branch starts a deployment; otherwise, click Deploy now for each change. Each deployment builds the image, runs theMigrate job, then replaces the web process’s instances. For a schema change, run python manage.py makemigrations locally and commit the new migration with the code. When you add a package, run pip freeze > requirements.txt again and commit it. See Deployments.
Add a custom domain
Add the domain on the application’s Domains tab, then add it toALLOWED_HOSTS, for example storefront-x7k2m.sevalla.app,shop.example.com, and deploy. Custom domains need a web process larger than H1.
Troubleshoot the deployment
Deploy with the API
This sequence creates the same database, application, job and deployment as Deploy to Sevalla, with the Sevalla API, and builds with Ingot. A script or an AI agent runs it as is. Run the steps in order in one shell: later steps use the IDs that earlier steps save in shell variables. Each step names the CLI command and the Sevalla MCP server tool that do the same. You need:- An API key with the Company developer role, in
SEVALLA_API_KEY. - The repository pushed as in Prepare the project for Sevalla, and a GitHub account with access to it connected to Sevalla. The API has no call that reports the connection: without access, the step that creates the application fails with
400andCannot access repository https://github.com/acme/storefront: Repository not found or you don't have access., followed by where to connect a Git account (My account in the dashboard) and, for GitHub, to give Sevalla’s GitHub App access to the repository. curl,jq,opensslandpython3.
Choose the location
listClustersV3) returns every location with its display_name and its region ID in location. Save one by region ID (see Locations):sevalla resources clusters. MCP: get_platform_options.Look up the process size
listProcessResourceTypesV3) returns the sizes by name. Save H1:sevalla resources process-types. MCP: get_platform_options.Look up the database size
listDatabaseResourceTypesV3). Save the smallest size, DB1:sevalla resources db-types. MCP: get_platform_options.Look up the PostgreSQL version
listDatabaseVersionsV3) returns the versions the location offers, oldest first. Save the newest:sevalla resources db-versions --cluster "$CLUSTER_ID" --type postgresql. MCP: not needed, create_database takes the newest version by default.Create the database
createDatabaseV3) starts creating the database and returns its ID. You choose the password, and the API never returns it, so keep it for the connection URL:sevalla databases create --name orders-db --type postgresql --db-version "$PG_VERSION" --cluster "$CLUSTER_ID" --resource-type "$DB1_ID" --db-name storefront --db-user storefront --db-password "$DB_PASSWORD". MCP: create_database, which generates a password it never returns. With connect_to_application_id and env_var_name: "DB_URL", once the application exists, it also does the internal connection and adds DB_URL as a postgresql:// URL, which django-environ accepts too.Wait for the database
getDatabaseV3) shows status ready when the database is up, with its internal hostname and port:sevalla databases get "$DB_ID". MCP: get_database.Create the application
createApplicationV3) creates the application with a web process, and doesn’t deploy it:sevalla apps create --name storefront --cluster "$CLUSTER_ID" --source privateGit --git-type github --repository "$REPO" --branch "$BRANCH". MCP: create_application with deploy: false.Find the web process
listProcessesV3) returns the web process the application came with:sevalla apps processes list --app-id "$APP_ID". MCP: get_application.Size the web process
updateProcessV3) sets H1:h1. CLI: sevalla apps processes update "$WEB_ID" --app-id "$APP_ID" --resource-type "$H1_ID". MCP: scale_process with size_id and apply_now: false.Connect the database
createApplicationInternalConnectionV3):sevalla apps internal-connections create "$APP_ID" --target-id "$DB_ID" --target-type database. MCP: sevalla_api_create with createApplicationInternalConnectionV3 and the same body.Get the domain
listApplicationDomainsV3) returns the application’s sevalla.app domain, which ALLOWED_HOSTS needs:sevalla apps domains list --app-id "$APP_ID". MCP: get_application.Add the environment variables
createEnvironmentVariableV3), once per variable. The DB_* variables have the names and format of the dashboard’s internal connection, available during build and runtime as it adds them. SECRET_KEY and ALLOWED_HOSTS are available during runtime only:sevalla apps env-vars create "$APP_ID" --key SECRET_KEY --value "$SECRET_KEY", once per variable; the CLI makes each variable available during build and runtime. MCP: set_environment_variables, with buildtime: false for SECRET_KEY and ALLOWED_HOSTS.Create the migration job
createProcessV3) needs the size, a scaling_strategy and, for a job, the job_start_policy:sevalla apps processes create "$APP_ID" --name Migrate --type job --resource-type "$H1_ID" --command "python manage.py migrate --noinput" --job-start-policy beforeDeployment. MCP: sevalla_api_create with createProcessV3 and the same body.Deploy
triggerDeploymentV3) deploys the latest commit of the branch:sevalla apps deployments trigger "$APP_ID". MCP: trigger_deployment.Wait for the deployment
getDeploymentV3) reports the status, which ends as success, failed, cancelled or skipped. The loop keeps polling through a failed request, for up to 30 minutes:sevalla apps deployments get "$DEPLOYMENT_ID" --app-id "$APP_ID". MCP: get_deployment.Turn on auto-deploy
updateApplicationV3):true. CLI: sevalla apps update "$APP_ID" --data '{"auto_deploy": true}'. MCP: sevalla_api_update with updateApplicationV3 and the same body.APP_HOST in place of storefront-x7k2m.sevalla.app. To build with the Dockerfile instead, update the application with {"build_type": "dockerfile", "dockerfile_path": "Dockerfile", "docker_context": "."} before you deploy (CLI: sevalla apps update "$APP_ID" --data with the same body; its --build-type option leaves the Docker context unset).