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 uvicornCreate 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
uvicornImportant: Zenifra installs dependencies with
pip install -r requirements.txtfrom 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 mainStep 3 — Create the project on Zenifra
- In the console, set Project Source to Git repository and, under Git provider, select GitHub.
- Select the repository and the
mainbranch. - Under Runtime, select
Pythonand choose the Version. - In the Port field, keep
8000, the Python runtime default port. - In Start Command, use
uvicorn main:app --host 0.0.0.0 --port 8000. - If you want automatic updates on push, select Automatic by branch under Deployment mode.
- 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
gunicornNote 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