Quickstart

Quick Start — Python

Publish a working Python application on Zenifra using the Git repository source with the GitHub provider.

Prerequisites

  • Python 3.11 or newer installed locally
  • a GitHub account, with the Zenifra GitHub App installed and connected to the organization (see How to connect GitHub)
  • access to the Zenifra console

Note: This quickstart uses GitHub. The same flow works for a Forgejo repository; see Deploy via Forgejo.

Step 1 — Create your application

mkdir hello-zenifra-python
cd hello-zenifra-python
python -m venv .venv
source .venv/bin/activate
pip install fastapi uvicorn

Create main.py:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello from Zenifra!", "runtime": "python"}

@app.get("/health")
async def health():
    return {"status": "ok"}

Create requirements.txt with the dependencies:

fastapi
uvicorn

Important: Zenifra installs dependencies with pip install -r requirements.txt from the repository root (or from the Root directory set in the project). Without this file, no dependencies are installed.

Step 2 — Publish to GitHub

Create a repository on GitHub and push the code:

git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/your-username/hello-zenifra-python.git
git push -u origin main

Step 3 — Create the project on Zenifra

  1. In the console, set Project Source to Git repository and, under Git provider, select GitHub.
  2. Select the repository and the main branch.
  3. Under Runtime, select Python and choose the Version.
  4. In the Port field, keep 8000, the Python runtime default port.
  5. In Start Command, use uvicorn main:app --host 0.0.0.0 --port 8000.
  6. If you want automatic updates on push, select Automatic by branch under Deployment mode.
  7. Click Create Project.

Your application will be available at *.clients.zenifra.com.

Step 4 — Validate the deployment

Open the public URL and test /health. If the application does not respond, review the port, the Start Command, and the Build Logs. Application logs are available on every plan.

Publishing a Flask application

For Flask, the configuration is practically identical. Use gunicorn app:app --bind 0.0.0.0:8000 as the Start Command:

# app.py
from flask import Flask
app = Flask(__name__)

@app.route("/")
def hello():
    return {"message": "Hello from Zenifra with Flask!"}
# requirements.txt
flask
gunicorn

Note about runtime

On Zenifra, the runtime is chosen during project creation. For more details about dependency installation, commands, and limitations, see the Runtimes page.

Next steps

Last updated on

On this page