I have a python app that uses around 15 pip libraries. It also requires Azure Storage as it creates files. I'd like to publish this app to Azure Functions. How do I do this? How does Azure Function manage all the python libraries that I need? I can't seem to find any sample code.
My code is basically like this:
import libA
import libB
import libC
def function1(...):
Commands-For-Function1
def function2(...):
Commands-For-Function2
def function3(...):
Commands-For-Function3
function1(param1, param2).. # Execution
But with Azure function apps, it looks for an init function. How would I integrate my function into an azure function?
Also, would Azure Container Instances not be a better solution? I'd just have to containerise my solution and publish it.
Thanks
Azure Functions Python Project has some default folder structure recommended by Microsoft:
Whatever the dependencies, libraries and the shared function code, you can place in the shared code folder which is imported as modules in the main function _init_.py
file.
You can import all the packages / libraries /methods derived in the normal class files into Azure Functions Python using the import keyword (absolute and relative references):
from shared_code import my_first_helper_function #(absolute)
import shared_code.my_second_helper_function #(absolute)
from . import example #(relative)
Please refer here for more information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.