# Python

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

# Python

The presence of `requirements.txt`, `pyproject.toml`, or `Pipfile` triggers Python detection. Python 3.12 is used by default.

## FastAPI

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

app = FastAPI()

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

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

Start command (set it if the auto builder doesn't detect it):

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

## Django

```bash
DATABASE_URL=postgresql://user:pass@host:5432/db
DJANGO_SECRET_KEY=change-moi
DJANGO_ALLOWED_HOSTS=votre-domaine.webgune.dev
```

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

## Flask

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

> Whatever the framework, don't use the development server (`flask run`, `manage.py runserver`) in production. Prefer Gunicorn or Uvicorn, which are more robust under load.
