Python Applications

Deploy scalable Python APIs and backend services with automatic dependency installation and managed runtime environments.

Overview

RunxBuild automatically installs dependencies from your repository. Select your Python version in the dashboard when creating the service. Your application must listen on the port provided via the PORT environment variable.

Flask Example

from flask import Flask

app = Flask(__name__)

@app.route("/")
def home():
    return {"message": "RunxBuild Flask service running"}

if __name__ == "__main__":
    import os
    port = int(os.environ.get("PORT", 8000))
    debug = os.environ.get("DEBUG", "true").lower() == "true"
    app.run(host="0.0.0.0", port=port, debug=debug)

Start Command:

  • gunicorn app:app --bind 0.0.0.0:$PORT
  • or uvicorn app:app --host 0.0.0.0 --port $PORT

Django Example

settings.py:

import os
from pathlib import Path

BASE_DIR = Path(__file__).resolve().parent.parent
DEBUG = os.environ.get("DEBUG", "false").lower() == "true"
SECRET_KEY = os.environ.get("SECRET_KEY", "unsafe-secret")
ALLOWED_HOSTS = ["*"]

INSTALLED_APPS = ["django.contrib.contenttypes", "django.contrib.staticfiles"]
MIDDLEWARE = ["django.middleware.security.SecurityMiddleware", "django.middleware.common.CommonMiddleware"]
ROOT_URLCONF = "app.urls"
STATIC_URL = "static/"

urls.py:

from django.urls import path
from .views import home

urlpatterns = [path("", home)]

views.py:

from django.http import JsonResponse

def home(request):
    return JsonResponse({"message": "RunxBuild Django service running"})

Start Command:

  • gunicorn app.wsgi:application --bind 0.0.0.0:$PORT
  • or uvicorn app.asgi:application --host 0.0.0.0 --port $PORT

FastAPI Example

requirements.txt:

fastapi
uvicorn[standard]

main.py:

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def root():
    return {"message": "RunxBuild FastAPI service running"}

Start Command:

uvicorn main:app --host 0.0.0.0 --port $PORT

Deployment Settings

  • Build Command: pip install -r requirements.txt
  • Output Directory: (leave empty)
  • Start Command: (use framework-specific command above)

Dependencies are installed automatically. Runtime version is selected in the service creation UI.