ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add Docker-based app templates for PHP, Python, and Node.js
Juan Denise65c680ba283
diff --git a/serverkit b/serverkitindex 106f23d7..f7d6fb08 100644--- a/serverkit+++ b/serverkit@@ -87,6 +87,13 @@ cmd_help() {echo " backup-db Backup the database"echo " restore-db Restore database from backup"echo ""+ echo "App Management:"+ echo " create-app Create a new app (php, python, node)"+ echo " list-apps List all deployed apps"+ echo " start-app Start an app"+ echo " stop-app Stop an app"+ echo " app-logs View app logs"+ echo ""echo "Site Management:"echo " setup-proxy Setup host nginx as reverse proxy (run once)"echo " add-site Add a new site/domain"@@ -434,6 +441,183 @@ cmd_setup_proxy() {fi}+cmd_create_app() {+ check_root++ TYPE="$1"+ NAME="$2"+ PORT="$3"++ if [ -z "$TYPE" ] || [ -z "$NAME" ]; then+ echo "Usage: serverkit create-app <type> <name> [port]"+ echo ""+ echo "Types:"+ echo " php PHP 8.x application (nginx + php-fpm)"+ echo " python Python application (Flask/FastAPI/Django)"+ echo " node Node.js application (Express/Next.js)"+ echo ""+ echo "Examples:"+ echo " serverkit create-app php myblog"+ echo " serverkit create-app python myapi 8200"+ echo " serverkit create-app node myapp 8300"+ exit 1+ fi++ TEMPLATE_DIR="$INSTALL_DIR/templates/$TYPE"+ APP_DIR="/var/www/$NAME"++ if [ ! -d "$TEMPLATE_DIR" ]; then+ print_error "Unknown app type: $TYPE"+ echo "Available: php, python, node"+ exit 1+ fi++ if [ -d "$APP_DIR" ]; then+ print_warning "Directory already exists: $APP_DIR"+ read -p "Overwrite? (y/N) " -n 1 -r+ echo+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then+ exit 0+ fi+ rm -rf "$APP_DIR"+ fi++ # Determine default port based on type+ if [ -z "$PORT" ]; then+ case "$TYPE" in+ php) PORT=8100 ;;+ python) PORT=8200 ;;+ node) PORT=8300 ;;+ esac+ # Find next available port+ while ss -tlnp | grep -q ":$PORT "; do+ PORT=$((PORT + 1))+ done+ fi++ print_info "Creating $TYPE app: $NAME on port $PORT..."++ # Copy template+ mkdir -p /var/www+ cp -r "$TEMPLATE_DIR" "$APP_DIR"++ # Create .env from example+ if [ -f "$APP_DIR/.env.example" ]; then+ cp "$APP_DIR/.env.example" "$APP_DIR/.env"+ sed -i "s/APP_NAME=.*/APP_NAME=$NAME/g" "$APP_DIR/.env"+ sed -i "s/PORT=.*/PORT=$PORT/g" "$APP_DIR/.env"+ fi++ print_success "App created at $APP_DIR"+ echo ""+ echo "Next steps:"+ echo " 1. cd $APP_DIR"+ echo " 2. Edit .env and customize settings"+ echo " 3. Put your code in src/"+ echo " 4. docker compose up -d"+ echo " 5. sudo serverkit add-site your-domain.com $PORT"+ echo ""+}++cmd_list_apps() {+ print_header+ echo ""+ echo "Deployed Applications:"+ echo "─────────────────────────────────────────"++ if [ -d /var/www ]; then+ for app_dir in /var/www/*/; do+ if [ -f "$app_dir/docker-compose.yml" ]; then+ APP_NAME=$(basename "$app_dir")++ # Get port from .env+ if [ -f "$app_dir/.env" ]; then+ PORT=$(grep "^PORT=" "$app_dir/.env" | cut -d= -f2)+ else+ PORT="?"+ fi++ # Check if running+ if docker compose -f "$app_dir/docker-compose.yml" ps 2>/dev/null | grep -q "running"; then+ STATUS="${GREEN}●${NC} running"+ else+ STATUS="${RED}○${NC} stopped"+ fi++ printf " %b %-20s port %-6s %s\n" "$STATUS" "$APP_NAME" "$PORT" "$app_dir"+ fi+ done+ else+ echo " No apps found in /var/www/"+ fi+ echo ""+ echo "Create new app: sudo serverkit create-app <type> <name>"+ echo ""+}++cmd_start_app() {+ check_root+ NAME="$1"++ if [ -z "$NAME" ]; then+ echo "Usage: serverkit start-app <name>"+ cmd_list_apps+ exit 1+ fi++ APP_DIR="/var/www/$NAME"+ if [ ! -d "$APP_DIR" ]; then+ print_error "App not found: $NAME"+ exit 1+ fi++ print_info "Starting $NAME..."+ cd "$APP_DIR"+ docker compose up -d+ print_success "$NAME started"+}++cmd_stop_app() {+ check_root+ NAME="$1"++ if [ -z "$NAME" ]; then+ echo "Usage: serverkit stop-app <name>"+ cmd_list_apps+ exit 1+ fi++ APP_DIR="/var/www/$NAME"+ if [ ! -d "$APP_DIR" ]; then+ print_error "App not found: $NAME"+ exit 1+ fi++ print_info "Stopping $NAME..."+ cd "$APP_DIR"+ docker compose down+ print_success "$NAME stopped"+}++cmd_app_logs() {+ NAME="$1"++ if [ -z "$NAME" ]; then+ echo "Usage: serverkit app-logs <name>"+ cmd_list_apps+ exit 1+ fi++ APP_DIR="/var/www/$NAME"+ if [ ! -d "$APP_DIR" ]; then+ print_error "App not found: $NAME"+ exit 1+ fi++ cd "$APP_DIR"+ docker compose logs -f+}+cmd_add_site() {check_root@@ -620,6 +804,21 @@ case "${1:-help}" insetup-proxy)cmd_setup_proxy;;+ create-app)+ cmd_create_app "$2" "$3" "$4"+ ;;+ list-apps)+ cmd_list_apps+ ;;+ start-app)+ cmd_start_app "$2"+ ;;+ stop-app)+ cmd_stop_app "$2"+ ;;+ app-logs)+ cmd_app_logs "$2"+ ;;add-site)cmd_add_site "$2" "$3";;diff --git a/templates/node/.env.example b/templates/node/.env.examplenew file mode 100644index 00000000..99317b86--- /dev/null+++ b/templates/node/.env.example@@ -0,0 +1,14 @@+# Node.js App Configuration+APP_NAME=my-node-app+PORT=8300+APP_PORT=3000++# Node Version: 18, 20, 21+NODE_VERSION=20++# Environment+NODE_ENV=production++# Database (if using MongoDB)+# DB_USER=root+# DB_PASSWORD=secure-passworddiff --git a/templates/node/docker-compose.yml b/templates/node/docker-compose.ymlnew file mode 100644index 00000000..a1cae120--- /dev/null+++ b/templates/node/docker-compose.yml@@ -0,0 +1,49 @@+# Node.js Application Template+# Copy this folder to /var/www/your-app-name and customize+#+# Usage:+# 1. Copy: sudo serverkit create-app node myapp+# 2. Put your Node.js files in ./src/+# 3. Start: docker compose up -d+# 4. Add site: sudo serverkit add-site myapp.domain.com <PORT>++services:+ app:+ image: node:${NODE_VERSION:-20}-alpine+ container_name: ${APP_NAME:-node-app}+ restart: unless-stopped+ working_dir: /app+ command: sh -c "npm install && npm start"+ ports:+ - "${PORT:-8300}:${APP_PORT:-3000}"+ volumes:+ - ./src:/app+ - node_modules:/app/node_modules+ environment:+ - NODE_ENV=${NODE_ENV:-production}+ - PORT=${APP_PORT:-3000}+ networks:+ - app-network++ # Optional: MongoDB (uncomment if needed)+ # db:+ # image: mongo:7+ # container_name: ${APP_NAME:-node-app}-db+ # restart: unless-stopped+ # environment:+ # MONGO_INITDB_ROOT_USERNAME: ${DB_USER:-root}+ # MONGO_INITDB_ROOT_PASSWORD: ${DB_PASSWORD:-secret}+ # volumes:+ # - db-data:/data/db+ # networks:+ # - app-network++networks:+ app-network:+ driver: bridge++volumes:+ node_modules:++# volumes:+# db-data:diff --git a/templates/node/src/index.js b/templates/node/src/index.jsnew file mode 100644index 00000000..2896ac70--- /dev/null+++ b/templates/node/src/index.js@@ -0,0 +1,72 @@+/**+ * Sample Node.js Express Application+ * Replace this with your actual application code+ */++const express = require('express');+const app = express();+const port = process.env.PORT || 3000;++app.get('/', (req, res) => {+ res.send(`+ <!DOCTYPE html>+ <html lang="en">+ <head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Node.js App</title>+ <style>+ body {+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;+ max-width: 800px;+ margin: 50px auto;+ padding: 20px;+ background: #f5f5f5;+ }+ .card {+ background: white;+ padding: 30px;+ border-radius: 8px;+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);+ }+ h1 { color: #333; margin-bottom: 10px; }+ .version { color: #777; font-size: 14px; }+ .info { margin-top: 20px; padding: 15px; background: #fff3e0; border-radius: 4px; }+ a { color: #ff9800; }+ </style>+ </head>+ <body>+ <div class="card">+ <h1>Node.js App</h1>+ <p class="version">Node ${process.version} | Express</p>++ <div class="info">+ <strong>Your Node.js app is running!</strong>+ <p>Edit <code>src/index.js</code> to customize.</p>+ <p><a href="/health">Health Check</a> | <a href="/info">System Info</a></p>+ </div>+ </div>+ </body>+ </html>+ `);+});++app.get('/health', (req, res) => {+ res.json({+ status: 'healthy',+ node_version: process.version+ });+});++app.get('/info', (req, res) => {+ res.json({+ node_version: process.version,+ platform: process.platform,+ uptime: process.uptime(),+ memory: process.memoryUsage()+ });+});++app.listen(port, '0.0.0.0', () => {+ console.log(`Server running on port ${port}`);+});diff --git a/templates/node/src/package.json b/templates/node/src/package.jsonnew file mode 100644index 00000000..631525f1--- /dev/null+++ b/templates/node/src/package.json@@ -0,0 +1,13 @@+{+ "name": "my-node-app",+ "version": "1.0.0",+ "description": "Node.js Application",+ "main": "index.js",+ "scripts": {+ "start": "node index.js",+ "dev": "node --watch index.js"+ },+ "dependencies": {+ "express": "^4.18.2"+ }+}diff --git a/templates/php/.env.example b/templates/php/.env.examplenew file mode 100644index 00000000..e7f45018--- /dev/null+++ b/templates/php/.env.example@@ -0,0 +1,13 @@+# PHP App Configuration+APP_NAME=my-php-app+PORT=8100++# PHP Version: 8.0, 8.1, 8.2, 8.3+PHP_VERSION=8.2+PHP_MEMORY_LIMIT=256M++# Database (if using MySQL)+# DB_ROOT_PASSWORD=secure-root-password+# DB_NAME=myapp+# DB_USER=myapp+# DB_PASSWORD=secure-passworddiff --git a/templates/php/README.md b/templates/php/README.mdnew file mode 100644index 00000000..ff72c9c0--- /dev/null+++ b/templates/php/README.md@@ -0,0 +1,98 @@+# PHP Application Template++A Docker-based PHP application setup with nginx and optional MySQL.++## Quick Start++```bash+# Copy .env.example to .env and customize+cp .env.example .env++# Edit your settings+nano .env++# Start the app+docker compose up -d++# View logs+docker compose logs -f+```++## Configuration++Edit `.env` to customize:++| Variable | Description | Default |+|----------|-------------|---------|+| `APP_NAME` | Container name prefix | `my-php-app` |+| `PORT` | External port | `8100` |+| `PHP_VERSION` | PHP version (8.0, 8.1, 8.2, 8.3) | `8.2` |+| `PHP_MEMORY_LIMIT` | Memory limit | `256M` |++## Structure++```+.+├── docker-compose.yml # Docker configuration+├── nginx.conf # Nginx configuration+├── php.ini # PHP configuration+├── .env # Environment variables+└── src/ # Your PHP code goes here+ └── index.php+```++## Adding Extensions++To add PHP extensions, create a `Dockerfile`:++```dockerfile+FROM php:8.2-fpm++# Install common extensions+RUN docker-php-ext-install pdo pdo_mysql mysqli++# Install composer+COPY --from=composer:latest /usr/bin/composer /usr/bin/composer+```++Then update `docker-compose.yml`:++```yaml+services:+ app:+ build: .+ # ... rest of config+```++## Using with Database++1. Uncomment the `db` service in `docker-compose.yml`+2. Set database credentials in `.env`+3. Connect from PHP using host `db`++```php+$pdo = new PDO(+ 'mysql:host=db;dbname=' . getenv('DB_NAME'),+ getenv('DB_USER'),+ getenv('DB_PASSWORD')+);+```++## Commands++```bash+# Start+docker compose up -d++# Stop+docker compose down++# View logs+docker compose logs -f app++# Shell into PHP container+docker compose exec app bash++# Run composer+docker compose exec app composer install+```diff --git a/templates/php/docker-compose.yml b/templates/php/docker-compose.ymlnew file mode 100644index 00000000..ca173f4f--- /dev/null+++ b/templates/php/docker-compose.yml@@ -0,0 +1,57 @@+# PHP Application Template+# Copy this folder to /var/www/your-app-name and customize+#+# Usage:+# 1. Copy: sudo serverkit create-app php myapp+# 2. Put your PHP files in ./src/+# 3. Start: docker compose up -d+# 4. Add site: sudo serverkit add-site myapp.domain.com <PORT>++services:+ app:+ image: php:${PHP_VERSION:-8.2}-fpm+ container_name: ${APP_NAME:-php-app}+ restart: unless-stopped+ volumes:+ - ./src:/var/www/html+ - ./php.ini:/usr/local/etc/php/conf.d/custom.ini:ro+ environment:+ - PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-256M}+ networks:+ - app-network++ nginx:+ image: nginx:alpine+ container_name: ${APP_NAME:-php-app}-nginx+ restart: unless-stopped+ ports:+ - "${PORT:-8100}:80"+ volumes:+ - ./src:/var/www/html:ro+ - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro+ depends_on:+ - app+ networks:+ - app-network++ # Optional: Database (uncomment if needed)+ # db:+ # image: mysql:8.0+ # container_name: ${APP_NAME:-php-app}-db+ # restart: unless-stopped+ # environment:+ # MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-secret}+ # MYSQL_DATABASE: ${DB_NAME:-app}+ # MYSQL_USER: ${DB_USER:-app}+ # MYSQL_PASSWORD: ${DB_PASSWORD:-secret}+ # volumes:+ # - db-data:/var/lib/mysql+ # networks:+ # - app-network++networks:+ app-network:+ driver: bridge++# volumes:+# db-data:diff --git a/templates/php/nginx.conf b/templates/php/nginx.confnew file mode 100644index 00000000..9c9005a0--- /dev/null+++ b/templates/php/nginx.conf@@ -0,0 +1,32 @@+server {+ listen 80;+ server_name localhost;+ root /var/www/html;+ index index.php index.html;++ # Security headers+ add_header X-Frame-Options "SAMEORIGIN" always;+ add_header X-Content-Type-Options "nosniff" always;++ location / {+ try_files $uri $uri/ /index.php?$query_string;+ }++ location ~ \.php$ {+ fastcgi_pass app:9000;+ fastcgi_index index.php;+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;+ include fastcgi_params;+ fastcgi_read_timeout 300;+ }++ location ~ /\.ht {+ deny all;+ }++ # Cache static assets+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {+ expires 1y;+ add_header Cache-Control "public, immutable";+ }+}diff --git a/templates/php/php.ini b/templates/php/php.ininew file mode 100644index 00000000..1d5b7b66--- /dev/null+++ b/templates/php/php.ini@@ -0,0 +1,10 @@+; Custom PHP Configuration+memory_limit = 256M+upload_max_filesize = 64M+post_max_size = 64M+max_execution_time = 300+max_input_time = 300+display_errors = Off+log_errors = On+error_log = /var/log/php_errors.log+date.timezone = UTCdiff --git a/templates/php/src/index.php b/templates/php/src/index.phpnew file mode 100644index 00000000..122f9c40--- /dev/null+++ b/templates/php/src/index.php@@ -0,0 +1,48 @@+<?php+/**+ * Sample PHP Application+ * Replace this with your actual application code+ */++$appName = getenv('APP_NAME') ?: 'PHP App';+$phpVersion = phpversion();+?>+<!DOCTYPE html>+<html lang="en">+<head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title><?= htmlspecialchars($appName) ?></title>+ <style>+ body {+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;+ max-width: 800px;+ margin: 50px auto;+ padding: 20px;+ background: #f5f5f5;+ }+ .card {+ background: white;+ padding: 30px;+ border-radius: 8px;+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);+ }+ h1 { color: #333; margin-bottom: 10px; }+ .version { color: #777; font-size: 14px; }+ .info { margin-top: 20px; padding: 15px; background: #e8f5e9; border-radius: 4px; }+ a { color: #4CAF50; }+ </style>+</head>+<body>+ <div class="card">+ <h1><?= htmlspecialchars($appName) ?></h1>+ <p class="version">PHP <?= $phpVersion ?></p>++ <div class="info">+ <strong>Your PHP app is running!</strong>+ <p>Put your PHP files in the <code>src/</code> directory.</p>+ <p><a href="info.php">View PHP Info</a></p>+ </div>+ </div>+</body>+</html>diff --git a/templates/php/src/info.php b/templates/php/src/info.phpnew file mode 100644index 00000000..4d9179a3--- /dev/null+++ b/templates/php/src/info.php@@ -0,0 +1,3 @@+<?php+// PHP Info Page - Remove in production!+phpinfo();diff --git a/templates/python/.env.example b/templates/python/.env.examplenew file mode 100644index 00000000..c0a2c28f--- /dev/null+++ b/templates/python/.env.example@@ -0,0 +1,15 @@+# Python App Configuration+APP_NAME=my-python-app+PORT=8200+APP_PORT=8000++# Python Version: 3.9, 3.10, 3.11, 3.12+PYTHON_VERSION=3.12++# Entry point (relative to src/)+ENTRYPOINT=app.py++# Database (if using PostgreSQL)+# DB_NAME=myapp+# DB_USER=myapp+# DB_PASSWORD=secure-passworddiff --git a/templates/python/README.md b/templates/python/README.mdnew file mode 100644index 00000000..6262e03f--- /dev/null+++ b/templates/python/README.md@@ -0,0 +1,131 @@+# Python Application Template++A Docker-based Python application setup with optional PostgreSQL and Redis.++## Quick Start++```bash+# Copy .env.example to .env and customize+cp .env.example .env++# Edit your settings+nano .env++# Start the app+docker compose up -d++# View logs+docker compose logs -f+```++## Configuration++Edit `.env` to customize:++| Variable | Description | Default |+|----------|-------------|---------|+| `APP_NAME` | Container name prefix | `my-python-app` |+| `PORT` | External port | `8200` |+| `APP_PORT` | Internal app port | `8000` |+| `PYTHON_VERSION` | Python version (3.9-3.12) | `3.12` |+| `ENTRYPOINT` | Main Python file | `app.py` |++## Structure++```+.+├── docker-compose.yml # Docker configuration+├── .env # Environment variables+└── src/ # Your Python code+ ├── app.py # Main application+ └── requirements.txt+```++## Using Different Frameworks++### Flask (default)+```python+from flask import Flask+app = Flask(__name__)+[email protected]('/')+def home():+ return 'Hello World'++if __name__ == '__main__':+ app.run(host='0.0.0.0', port=8000)+```++### FastAPI+Update `requirements.txt`:+```+fastapi>=0.109.0+uvicorn>=0.27.0+```++Update `.env`:+```+ENTRYPOINT=main.py+```++Create `src/main.py`:+```python+from fastapi import FastAPI+import uvicorn++app = FastAPI()+[email protected]('/')+def home():+ return {'message': 'Hello World'}++if __name__ == '__main__':+ uvicorn.run(app, host='0.0.0.0', port=8000)+```++### Django+Update `docker-compose.yml` command:+```yaml+command: >+ sh -c "pip install -r requirements.txt &&+ python manage.py runserver 0.0.0.0:8000"+```++## Using with Database++1. Uncomment the `db` service in `docker-compose.yml`+2. Set database credentials in `.env`+3. Connect from Python using host `db`++```python+import psycopg2++conn = psycopg2.connect(+ host='db',+ database=os.environ['DB_NAME'],+ user=os.environ['DB_USER'],+ password=os.environ['DB_PASSWORD']+)+```++## Commands++```bash+# Start+docker compose up -d++# Stop+docker compose down++# View logs+docker compose logs -f app++# Shell into container+docker compose exec app bash++# Install new package+docker compose exec app pip install package-name++# Run Python command+docker compose exec app python -c "print('hello')"+```diff --git a/templates/python/docker-compose.yml b/templates/python/docker-compose.ymlnew file mode 100644index 00000000..56ad2809--- /dev/null+++ b/templates/python/docker-compose.yml@@ -0,0 +1,57 @@+# Python Application Template+# Copy this folder to /var/www/your-app-name and customize+#+# Usage:+# 1. Copy: sudo serverkit create-app python myapp+# 2. Put your Python files in ./src/+# 3. Start: docker compose up -d+# 4. Add site: sudo serverkit add-site myapp.domain.com <PORT>++services:+ app:+ image: python:${PYTHON_VERSION:-3.12}-slim+ container_name: ${APP_NAME:-python-app}+ restart: unless-stopped+ working_dir: /app+ command: >+ sh -c "pip install --no-cache-dir -r requirements.txt 2>/dev/null || true &&+ python ${ENTRYPOINT:-app.py}"+ ports:+ - "${PORT:-8200}:${APP_PORT:-8000}"+ volumes:+ - ./src:/app+ environment:+ - PYTHONUNBUFFERED=1+ - PYTHONDONTWRITEBYTECODE=1+ - PORT=${APP_PORT:-8000}+ networks:+ - app-network++ # Optional: Database (uncomment if needed)+ # db:+ # image: postgres:15+ # container_name: ${APP_NAME:-python-app}-db+ # restart: unless-stopped+ # environment:+ # POSTGRES_DB: ${DB_NAME:-app}+ # POSTGRES_USER: ${DB_USER:-app}+ # POSTGRES_PASSWORD: ${DB_PASSWORD:-secret}+ # volumes:+ # - db-data:/var/lib/postgresql/data+ # networks:+ # - app-network++ # Optional: Redis (uncomment if needed)+ # redis:+ # image: redis:alpine+ # container_name: ${APP_NAME:-python-app}-redis+ # restart: unless-stopped+ # networks:+ # - app-network++networks:+ app-network:+ driver: bridge++# volumes:+# db-data:diff --git a/templates/python/src/app.py b/templates/python/src/app.pynew file mode 100644index 00000000..b96f1dd0--- /dev/null+++ b/templates/python/src/app.py@@ -0,0 +1,73 @@+"""+Sample Python Flask Application+Replace this with your actual application code+"""++import os+import sys+from flask import Flask, jsonify++app = Flask(__name__)+[email protected]('/')+def home():+ return f'''+ <!DOCTYPE html>+ <html lang="en">+ <head>+ <meta charset="UTF-8">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <title>Python App</title>+ <style>+ body {{+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;+ max-width: 800px;+ margin: 50px auto;+ padding: 20px;+ background: #f5f5f5;+ }}+ .card {{+ background: white;+ padding: 30px;+ border-radius: 8px;+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);+ }}+ h1 {{ color: #333; margin-bottom: 10px; }}+ .version {{ color: #777; font-size: 14px; }}+ .info {{ margin-top: 20px; padding: 15px; background: #e3f2fd; border-radius: 4px; }}+ a {{ color: #2196F3; }}+ </style>+ </head>+ <body>+ <div class="card">+ <h1>Python App</h1>+ <p class="version">Python {sys.version.split()[0]} | Flask {Flask.__version__ if hasattr(Flask, '__version__') else 'N/A'}</p>++ <div class="info">+ <strong>Your Python app is running!</strong>+ <p>Edit <code>src/app.py</code> to customize.</p>+ <p><a href="/health">Health Check</a> | <a href="/info">System Info</a></p>+ </div>+ </div>+ </body>+ </html>+ '''+[email protected]('/health')+def health():+ return jsonify({+ 'status': 'healthy',+ 'python_version': sys.version.split()[0]+ })+[email protected]('/info')+def info():+ return jsonify({+ 'python_version': sys.version,+ 'platform': sys.platform,+ 'environment': dict(os.environ)+ })++if __name__ == '__main__':+ port = int(os.environ.get('PORT', 8000))+ app.run(host='0.0.0.0', port=port, debug=False)diff --git a/templates/python/src/requirements.txt b/templates/python/src/requirements.txtnew file mode 100644index 00000000..d19918b0--- /dev/null+++ b/templates/python/src/requirements.txt@@ -0,0 +1,15 @@+# Python Dependencies+# Add your dependencies here++# Web frameworks (uncomment one)+flask>=3.0.0+# fastapi>=0.109.0+# uvicorn>=0.27.0+# django>=5.0++# Common utilities+# requests>=2.31.0+# python-dotenv>=1.0.0+# sqlalchemy>=2.0.0+# psycopg2-binary>=2.9.9+# redis>=5.0.0