Search code examples
pythonazureazure-webjobs

How to connect Azure Python package in WebJob


I have my code in my local related to our business, I am trying to deploy it to Azure but displayed with few import errors and few internal server errors.

Here I am interacting with some services like storage etc.. so I installed all the services with pip(pip is also a latest version).

I am new to Azure in interacting with SDK's. Any suggestions or steps are highly appreciated


Solution

  • We will have all the packages in sitepackages in our local. Whenever you install all the packages you need to install them by activating virtual environment in you local, so that they will be accessible when you import them.

    You can try something like below in you code so that your webjob will load all your packages when the code runs:

    import sys
    package = "D:\home\site\wwwroot\env\Lib\site-packages"
    sys.path.append(package)
    

    Also you can refer to this SO where we have clear explanation similar to your problem, thanks to Gary for covering it.