# Python

Source : https://webgune.cloud/de-de/docs/web-python · Mis à jour le 2026-10-27

# Python

Das Vorhandensein von `requirements.txt`, `pyproject.toml` oder `Pipfile` löst die Python-Erkennung aus. Python 3.12 wird standardmäßig verwendet.

## FastAPI

```python
# main.py
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def root():
    return {"message": "Hello Webgune"}
```

```text
# requirements.txt
fastapi
uvicorn[standard]
```

Startbefehl (festzulegen, falls der Auto-Builder ihn nicht erkennt):

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

## Django

```bash
DATABASE_URL=postgresql://user:pass@host:5432/db
DJANGO_SECRET_KEY=aendere-mich
DJANGO_ALLOWED_HOSTS=ihre-domain.webgune.dev
```

```bash
python manage.py migrate
gunicorn meinprojekt.wsgi:application --bind 0.0.0.0:$PORT
```

## Flask

```bash
gunicorn app:app --bind 0.0.0.0:$PORT --workers 2
```

> Verwenden Sie unabhängig vom Framework nicht den Entwicklungsserver (`flask run`, `manage.py runserver`) in Produktion. Bevorzugen Sie Gunicorn oder Uvicorn, die unter Last robuster sind.
