skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. 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:

    |-workspace
    |  |-func1
    |  |  |-function.json
    |  |-func2
    |  |  |-function.json
    |  |-src
    |  |  |-funcs
    |  |     |-func1.py
    |  |     |-func2.py
    |  |-host.json
    
    

    And this way you actually can have any source structure you would like.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search