Python deployment with virtualenv (on a no-internet-access server)

后端 未结 1 1314
独厮守ぢ
独厮守ぢ 2021-01-04 11:19

My production server has no access to the internet, so it\'s a bit a mess copying all the dependencies from my dev machine to the production/development server.

If I

相关标签:
1条回答
  • 2021-01-04 11:58

    Three options I would consider:

    1. Run your own PyPI mirror with the dependencies you need. You really only need to build the file layout and pull from your local server using the index-url flag:

      $ pip install --index-url http://pypi.beastcraft.net/ numpy

    2. Build virtualenvs on the same architecture and copy those over as needed.

      This works, but you're taking a risk on true portability.

    3. Use terrarium to build virtual environments then bring those over (basically option 2 but with easier bookkeeping/automation).

    I've done all of these and actually think that hosting your own PyPI mirror is the best option. It gives you the most flexibility when you're making a deployment or trying out new code.

    0 讨论(0)
提交回复
热议问题