Deploying with pyenv

ZiliKou edited this page May 31, 2017 · 3 revisions

Setting up pyenv on a production server is exactly the same as in development. Some considerations for a hypothetical deployment strategy:

  • It is suggested that there is a single user for deployment, e.g. "app" user
  • PYENV_ROOT is at the default location: ~app/.pyenv
  • Python versions are either installed or symlinked to ~app/.pyenv/versions
  • pyenv version 0.2 or greater is recommended.

Users of Capistrano may find these projects useful:

Ensure consistent PATH for processes

Interactive, non-interactive shells, cron jobs, and similar processes for the "app" user all must ensure that pyenv is present in the PATH:

export PATH=~/.pyenv/shims:~/.pyenv/bin:"$PATH"

About systemd

If you use systemd, the PATH must be real PATH, not shims:

Environment=PATH=/home/$USER/.pyenv/versions/$VERSION/bin:$PATH
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.