I have an azure functions directory structure that looks something like this:
/azure_function_project
|-- function_1
| |-- __init__.py
| |-- function.json
|-- function_2
| |-- __init__.py
| |-- function.json
however for my use it would be very handy to organize into something like this:
/azure_function_project
|-- functions_a
| |-- function_a1
| | |-- __init__.py
| | |-- function.json
| |-- function_a2
| | |-- __init__.py
| | |-- function.json
where I added an extra directory to contain multiple functions relating to "functions_a
". Is there any way to ask azure functions to look into these directories when running/publishing?
2
Answers
take a look at the v2 bindings, you may be able to achieve your desired structure, but with the v1 bindings the function folders must be in the top level of the project.
I don’t think it is possible with V1 bindings, so V2 (decorator-style) can be very beneficial for you. However, if have to use older style you can use scriptFile setting to point to another directory or another file (For example, "scriptFile": "../src/funcs/func1.py"). So it can look like this:
And this way you actually can have any source structure you would like.