I am attempting to deploy a python Function App on Azure, however, due to the required configuration, all the outbound traffic must route internally. This means pip
fails during the build as it cannot reach PyPI. Locally I use our own artifactory for python packages, but this requires some setup of proxies and certificates.
Instead, I saw you can do a custom build by pip
installing local to the project
$ pip install --target"<project-dir>/.python_packages/lib/site-packages" -r requirements.txt
Is this all I need to do? Or do I have to update my package imports to reference this folder, and if so how do I do that correctly?
from azure.mgmt.resource import ResourceClient
would it become?
.python_packages.lib.site-packages.azure.mgmt.resource import ResourceClient
If you want to import packages from a given folder (for example a folder named packages
) you can do the following in your script.
import sys
sys.path.append("path_to_packages_folder")
All the packages that are in that folder will now be available for import, so you can now simply do the normal import: from azure.mgmt.resource import ResourceClient
.