diff --git a/docs/recipes.rst b/docs/recipes.rst index 865dae5e0..3df207389 100644 --- a/docs/recipes.rst +++ b/docs/recipes.rst @@ -31,3 +31,30 @@ configuration can be passed in the same way: $ service.pex myapp:appinstance -c /path/to/gunicorn_config.py And there you have it, a fully portable python web service. + +PEX and Proxy settings +---------------- + +While building pex files, you may need to fetch dependencies thought a proxy. The easiest way is to use pex cli with the requests extra and environment variables. Following are the steps to do just that: + +1) Install pex with requests + +.. code-block:: bash + + $ pip install pex[requests] + +2) Set the environment variables + +.. code-block:: bash + + $ # Hopefully your proxy supports https! If not, you can export HTTP_PROXY: + $ # export HTTP_PROXY='http://user:pass@address:port' + $ export HTTPS_PROXY='https://user:pass@address:port' + +3) Now you can test by running + +.. code-block:: bash + + $ pex -v pex + +For more information on the requests module support for proxies via environment variables, see the official documentation here: http://docs.python-requests.org/en/master/user/advanced/#proxies.