Run the sync¶
This guide shows how to keep your site and Ponyglot in sync with the connector’s sync
command: from cron, or as a worker process.
What the sync does¶
Saving content on your site only marks it as changed; it never waits for Ponyglot. The HTTP work happens in one command:
$ python manage.py ponyglot sync
Each run:
pushes what changed since the last run, and reports deleted objects,
reports your editors’ decisions: published drafts, applied or rejected suggestions, including their corrections,
fetches finished translations and writes them as drafts or suggestions.
It prints one line per run, for example
pushed 3, unchanged 0, deleted 0, reviews reported 1, translations received 12, followed by
warnings and translations waiting for a QA review, if any.
Run it from cron¶
Every few minutes is enough. For example, every 5 minutes:
*/5 * * * * cd /srv/mysite && .venv/bin/python manage.py ponyglot sync
Make sure cron has the same environment as your site, in particular PONYGLOT_API_KEY and
DJANGO_SETTINGS_MODULE.
Or run it as a worker¶
On platforms with long-running processes (a Procfile, systemd, a container), loop instead:
ponyglot: python manage.py ponyglot sync --loop 60
--loop 60 starts a run every 60 seconds. A failed run, for example while the network is down,
is reported and retried in the next round instead of stopping the worker. On SIGTERM the
worker finishes the current round and exits, so deploys don’t interrupt a write.
When you don’t want to wait¶
The translations dialogs in django CMS and the admin fetch their own content’s translations when no sync ran in the last 15 minutes, and offer Fetch translations now.
Sync now on the admin’s Ponyglot › Translation dashboard runs a full sync.
python manage.py ponyglot sync --no-pullonly sends changes and reports decisions, without fetching translations.
Check that it runs¶
python manage.py ponyglot statusshows the state per language (see Connector commands).The translation dashboard in the admin lists the recent sync rounds.
In Ponyglot, the site’s page shows the connector version and the time of the last handshake.