Docs menu
Getting started with Python
Deploy a minimal Django app to Primcloud end-to-end using a sample repo, in about five minutes.
On this page
This guide walks through deploying a small Python web app to Primcloud. You'll fork a sample Django repo, import it, watch the build, and reach the deployed app at a *.primcloud.app URL. Takes about five minutes.
Before you start#
You'll need:
- A Primcloud account. Standard accounts are $0 to create; compute is metered by the minute from the moment you deploy, starting around $5/mo for the smallest app.
- A git provider connected to your account with access to at least one repo.
- Optional: Python 3.10 or newer installed locally, if you want to run the sample or make changes before deploying.
The sample app#
For this guide, use Heroku's heroku/python-getting-started repo. It's a minimal Django app with a Procfile, a requirements.txt, and a .python-version: everything the Primcloud Runtime needs to detect and deploy it with no changes. Fork it into an account your connected provider can see, so Primcloud can pull from it.
1. Create the application#
From the Primcloud dashboard, hit Import Git Repository on the applications list. The import wizard walks you through three quick steps:
- Pick a repository: select your fork of
python-getting-started. - Configure the deployment:
- Branch:
main(the fork's default). - Region: US East (NYC).
- Branch:
- Review and create: Primcloud auto-provisions the app's primary
*.primcloud.appsubdomain on the production environment.
2. Deploy#
The first deployment kicks off automatically when the app is created. Watch it stream in the Deployments tab:
- Detection. Primcloud sees
requirements.txtand.python-versionat the repo root and picks the Python toolchain. - Python install. The Python version listed in
.python-versionis downloaded (or restored from the per-app cache) and installed into its own layer. - Dependencies. The build creates a virtual environment, then runs
pip install -r requirements.txtagainst it. - Django hook. Because Django is a declared dependency and the repo has a
manage.py, the build automatically runspython manage.py collectstatic --noinputso static assets are baked into the image. - Release. Primcloud reads the
Procfileand starts thewebprocess on the pod formation. The sample'swebline runsgunicorn --config gunicorn.conf.py gettingstarted.wsgi.
When the deployment status flips to Release Succeeded, the app is live.
3. Reach the app#
The application dashboard shows the assigned *.primcloud.app URL in the header. Click it, and the sample app's homepage loads.
If it doesn't come up:
- Deployments: the build log has the full output from the Python build, including pip's install output and any
collectstaticerrors. - Logs: runtime output from your app streams there, including any Gunicorn or Django startup errors.
- Confirm your app binds to the port in
$PORT. Primcloud sets this env var on thewebformation, and the sample'sProcfilepasses it through to Gunicorn automatically.
Where to go next#
- Deploying a different Python app: Python on Primcloud for detection, package manager selection, and the install and compile phases.
- Pinning to a specific Python version: Runtime versions.
- Switching to Poetry or uv, or using a private package index: Package managers.
- Adding a build hook or an OS-level library: Customizing the build.
- Django-specific quirks: Deploying Django.
- Flask instead: Deploying Flask.
- Something breaking: Troubleshooting Python.