Files
ServerKit/backend/templates/python-app.yaml
T
Juan Denis f05d056678 Improve port variable handling and add app cleanup CLI
Port variables in templates are now hidden and always auto-generated, never using user-supplied values. The TemplateService's port assignment checks both database and Docker for used ports, and removes obsolete Docker Compose version fields. Adds new CLI commands for cleaning up all applications, performing a factory reset, and listing applications. Minor update to AuthContext to mark setup as complete after registration.
2026-01-19 16:56:57 -05:00

85 lines
1.9 KiB
YAML

id: python-app
name: Python Application
version: "3.12"
description: Custom Python application. Supports Python 3.9-3.12. Perfect for Flask, FastAPI, Django, or any Python project.
icon: https://www.python.org/static/community_logos/python-logo-generic.svg
website: https://www.python.org
documentation: https://docs.python.org/3/
categories:
- development
- api
- custom
variables:
- name: HTTP_PORT
description: HTTP port for the application
type: port
default: "8200"
hidden: true
- name: PYTHON_VERSION
description: Python version (3.9, 3.10, 3.11, 3.12)
type: string
default: "3.12"
- name: APP_PORT
description: Internal app port
type: string
default: "8000"
ports:
- port: 8200
protocol: tcp
description: Web interface
volumes:
- name: app
path: /app
description: Application files (put your Python code here)
requirements:
memory: 256MB
storage: 1GB
compose:
services:
app:
image: python:${PYTHON_VERSION:-3.12}-slim
container_name: ${APP_NAME}
restart: unless-stopped
working_dir: /app
command: >
sh -c "pip install --no-cache-dir -r requirements.txt 2>/dev/null || true &&
python app.py"
ports:
- "${HTTP_PORT}:${APP_PORT:-8000}"
volumes:
- app_data:/app
environment:
- PYTHONUNBUFFERED=1
- PORT=${APP_PORT:-8000}
volumes:
app_data:
post_install: |
Your Python application is ready!
To add your code:
docker cp ./your-files/. ${APP_NAME}:/app/
To access shell:
docker exec -it ${APP_NAME} bash
To install packages:
docker exec -it ${APP_NAME} pip install flask
Example app.py:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8000)