2026-11-29
A Python app runs as the account's own system user. The panel starts it on a free port between 3000 and 3999, gives it the PORT value in its environment, and serves it through nginx on its domain. Our test app printed a greeting and served JSON through the Cloudflare proxy.
1. Attach a domain
- Attach the domain to an account on the Domains page, or add a subdomain under it on the Subdomains and redirects page.
2. Write the code
tar -czf app.tar.gz -C app .- Write main.py. It listens on 127.0.0.1 and on the port in the PORT variable: HTTPServer(('127.0.0.1', int(os.environ.get('PORT', '3000'))), Handler).
- Pack the folder as a tar.gz with main.py at the top level, plus any other files such as cron.py.
- Send the package with the deploy call: packageBase64 holds the base64 text of the tar.gz, kind is python and entry is main.py. The deploy runs at once within the token's policy.
3. Environment values
- set_env_value stores a value sealed on the server. The value applies on the next restart.
- list_env_keys shows only the names. No tool shows a value again.
- restart_app restarts the app with its code and its values.
4. Check it
- app_status says active while the process runs.
- read_app_logs returns the last lines: the start line, the request lines and anything the app prints.
- curl -sS https://your-app-domain/ returns the app's text with status 200.
5. Cron
- add_cron_job takes the account id, a five-field schedule such as */5 * * * *, kind python and entry cron.py. The file must already be in the app folder.
- list_cron_jobs shows the job. To see its last run, check the file the job writes, or the incident list if it fails.
6. Preview
- create_preview makes a copy of the current code on its own host, such as id.preview.your-app-domain. It expires after 24 hours.
- Check it with curl --resolve, because the preview host needs its own public DNS record for a normal visit.
The limit: one app folder per account
All apps of one account share one app folder. A new package for one domain replaces that folder for every app of the account. The helper keeps the old folder as app.previous. If a deploy fails after that step, the folder may already have changed, so keep a copy of your code. Give each app its own account, or put the code of every app of the account into one package.
