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

Deploy a small Python web app to Primcloud: fork a sample Django repo, import it, watch the build, and open the app at its *.primcloud.app URL. It 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 Primcloud account; see Source Control.
  • 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 you've connected to Primcloud.

1. Create the application#

Hit Import Git Repository on the applications list, then:

  1. Select your fork of python-getting-started.
  2. Configure the branch (main) and a region.
  3. Verify the commit and hit Import.

2. Deploy#

The first deployment starts as soon as the app is created, and its build log streams live:

  • Detection. Primcloud sees requirements.txt and .python-version at the repo root and picks the Python toolchain.
  • Python install. The Python version listed in .python-version is installed.
  • Dependencies. The build creates a virtual environment, then runs pip install -r requirements.txt against it.
  • Django hook. Because Django is a declared dependency and the repo has a manage.py, the build automatically runs python manage.py collectstatic --noinput so static files are collected during the build.
  • Start. Primcloud reads the Procfile and starts the web process. The sample's web line runs gunicorn --config gunicorn.conf.py gettingstarted.wsgi.

When the deployment's Rollout phase shows Complete, the app is live.

3. Reach the app#

Click the *.primcloud.app URL in the dashboard header to open the app.

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 collectstatic errors.
  • 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 the web formation, and the sample's Procfile passes it through to Gunicorn automatically.

Where to go next#