Python project
What is inside the container
- Python of the chosen branch with
pipandvenv, plus a compiler,pkg-configand the PostgreSQL and MariaDB/MySQL client libraries, sopsycopgandmysqlclientinstall without extra steps. - The virtual environment
.venvin the project root is already added toPATH: create it with the build command, andpython,pip,gunicorn,uvicornfrom it run without a path and withoutactivate. - Your process: the supervisor starts it with the start command and restarts it if it exits. The port is in the
PORTvariable (8080by default); listen on0.0.0.0. PYTHONUNBUFFERED=1— output shows up in "Logs" at once; there is nopipcache, so as not to take disk space.
1. Create a project
In the wizard (how to create a project), choose the Python tile and the version:

- Build command — runs after every Git deploy and with the "Build" button:
python -m venv .venv && pip install -r src/requirements.txt - Start command — the application server, for example
cd src && gunicorn mysite.wsgi --bind 0.0.0.0:$PORT. - Application port — leave
8080and listen on$PORT.

2. Step by step
- Code and dependencies. The repository goes to the
srcdirectory (Git deploy), and it must containrequirements.txt. Do not put the.venvdirectory into the repository. - Settings — in the "Environment variables" block: the secret key, the database address, debug mode off.
- Database — "Databases" → "A database for this project"; take the host and port from the database card.
- Deploy — the "Deploy" button: fetch the branch, build, restart. Progress is shown in the "Deploy" line, the process output in "Logs".
3. How many workers
Each gunicorn worker is a separate process with a copy of the application: Django with two workers uses about 120 MB. On a 512 MB plan take 2 workers, on 1 GB 3–4; asynchronous applications (FastAPI, uvicorn) usually get by with a single process.
4. Background tasks
- Queue workers (Celery, RQ, Dramatiq) — as separate background processes in the "Processes and cron" block, for example
cd src && celery -A mysite worker --concurrency 2. For now the queue broker has to be external. - Cron — commands on a schedule:
0 3 * * * cd src && python manage.py clearsessions.

A Telegram bot on aiogram or python-telegram-bot runs as the main or a background process; about long polling, the webhook and the token — on the "Telegram bot hosting" page.
5. If something goes wrong
- 502. The server is not running or listens on
127.0.0.1— you need--bind 0.0.0.0:$PORT(gunicorn) or--host 0.0.0.0 --port $PORT(uvicorn). The cause is in "Logs". - "gunicorn: not found". There is no
.venv, or the package is not inrequirements.txt: check the build output. - A package with a C extension does not build. The compiler and the database libraries are already there; for other system libraries choose the "Custom image" handler.
- The process exits for lack of memory. Reduce the number of workers or upgrade the plan; it is visible on the project's memory chart.