I followed this Microsoft tutorial using CLI to create Azure-Function in python.
I then created a second function, both HttpTriggered.
C:\Users\rnwol\workspace\anotherazfunc
├── host.json
└── LocalFunctionProj
├── host.json
├── HttpCONTACT
| ├── function.json
| ├── host.json
| ├── __init__.py
| └── __pycache__
├── HttpRNWOLF
| ├── function.json
| ├── __init__.py
| └── __pycache__
├── local.settings.json
└── requirements.txt
When in a Powershell terminal I can run both of the functions as follows...
(.venv) C:\Users\rnwol\workspace\anotherazfunc\LocalFunctionProj> func host start
Found Python version 3.8.2 (python).
%%%%%%
%%%%%%
@ %%%%%% @
@@ %%%%%% @@
@@@ %%%%%%%%%%% @@@
@@ %%%%%%%%%% @@
@@ %%%% @@
@@ %%% @@
@@ %% @@
%%
%
Azure Functions Core Tools (3.0.2245 Commit hash: 1d094e2f3ef79b9a478a1621ea7ec3f93ac1910d)
Function Runtime Version: 3.0.13139.0
[15/04/2020 20:43:27] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language:java
[15/04/2020 20:43:27] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language:node
[15/04/2020 20:43:27] FUNCTIONS_WORKER_RUNTIME set to python. Skipping WorkerConfig for language:powershell
[15/04/2020 20:43:28] Building host: startup suppressed: 'False', configuration suppressed: 'False', startup operation id: '21466b21-c6d0-4a25-9df4-61b42b364bef'
[15/04/2020 20:43:28] Reading host configuration file 'C:\Users\rnwol\workspace\anotherazfunc\LocalFunctionProj\host.json'
[15/04/2020 20:43:28] Host configuration file read:
[15/04/2020 20:43:28] {
[15/04/2020 20:43:28] "version": "2.0",
[15/04/2020 20:43:28] "extensionBundle": {
[15/04/2020 20:43:28] "id": "Microsoft.Azure.Functions.ExtensionBundle",
[15/04/2020 20:43:28] "version": "[1.*, 2.0.0)"
[15/04/2020 20:43:28] }
[15/04/2020 20:43:28] }
[15/04/2020 20:43:28] Reading functions metadata
[15/04/2020 20:43:28] 2 functions found
...
I can use httpie to trigger both functions as required.
THE PROBLEM - How to interactively debug in VS-Code?
When I now open the files in VS Code, for a single function, I can then press F5 to run the command to debug and step through the Trigger event and figure out what the problem is.
What configuration should I use to run both the functions such that I can set break point and debug interactively in VS-Code? I am using Windows 10.
Direction for solution
I have configured a sample template github repo https://github.com/rnwolf/azure-func-python-layout with the results of my research, which you could use as a starter for your Azure Functions.
The layout that works for me is below. Make sure to open VSCode in the root directory, multi3, in the example below. I have found you can delete the .vscode and the .vstest and then VSCode seems to figure out how to setup some valid defaults.
(.venv) ...orkspace/multi3$ tree -L 3 -a
.
├── .coverage
├── .coveragerc
├── .flake8
├── .git
├── .github
│ └── workflows
│ └── main.yml
├── .gitignore
├── .hypothesis
├── .pre-commit-config.yaml
├── .pylintrc
├── .python-version
├── .venv
│ ├── COPYING
│ ├── COPYING.GPL
│ ├── bin
│ │ ├── Activate.ps1
│ │ ├── activate
│ │ ├── activate.csh
│ │ ├── activate.fish
│ │ ├── autopep8-wrapper
│ │ ├── bandit
│ │ ├── bandit-baseline
│ │ ├── bandit-config-generator
│ │ ├── black
│ │ ├── blackd
│ │ ├── chardetect
│ │ ├── check-added-large-files
│ │ ├── check-ast
│ │ ├── check-builtin-literals
│ │ ├── check-byte-order-marker
│ │ ├── check-case-conflict
│ │ ├── check-docstring-first
│ │ ├── check-executables-have-shebangs
│ │ ├── check-json
│ │ ├── check-merge-conflict
│ │ ├── check-symlinks
│ │ ├── check-toml
│ │ ├── check-vcs-permalinks
│ │ ├── check-xml
│ │ ├── check-yaml
│ │ ├── coverage
│ │ ├── coverage-3.8
│ │ ├── coverage3
│ │ ├── debug-statement-hook
│ │ ├── detect-aws-credentials
│ │ ├── detect-private-key
│ │ ├── dmypy
│ │ ├── double-quote-string-fixer
│ │ ├── easy_install
│ │ ├── easy_install-3.8
│ │ ├── end-of-file-fixer
│ │ ├── epylint
│ │ ├── file-contents-sorter
│ │ ├── fix-encoding-pragma
│ │ ├── flake8
│ │ ├── forbid-new-submodules
│ │ ├── http
│ │ ├── https
│ │ ├── identify-cli
│ │ ├── isort
│ │ ├── mixed-line-ending
│ │ ├── mypy
│ │ ├── mypyc
│ │ ├── name-tests-test
│ │ ├── no-commit-to-branch
│ │ ├── nodeenv
│ │ ├── pbr
│ │ ├── pip
│ │ ├── pip-compile
│ │ ├── pip-sync
│ │ ├── pip3
│ │ ├── pip3.8
│ │ ├── pipenv
│ │ ├── pipenv-resolver
│ │ ├── pre-commit
│ │ ├── pre-commit-validate-config
│ │ ├── pre-commit-validate-manifest
│ │ ├── pretty-format-json
│ │ ├── py.test
│ │ ├── pycodestyle
│ │ ├── pydocstyle
│ │ ├── pyflakes
│ │ ├── pygmentize
│ │ ├── pylint
│ │ ├── pyreverse
│ │ ├── pytest
│ │ ├── python -> /home/rnwolf/.pyenv/versions/3.8.2/bin/python
│ │ ├── python3 -> python
│ │ ├── requirements-txt-fixer
│ │ ├── safety
│ │ ├── sort-simple-yaml
│ │ ├── stubgen
│ │ ├── stubtest
│ │ ├── symilar
│ │ ├── trailing-whitespace-fixer
│ │ ├── virtualenv
│ │ └── virtualenv-clone
│ ├── include
│ ├── lib
│ │ └── python3.8
│ ├── lib64 -> lib
│ └── pyvenv.cfg
├── .vscode
│ ├── .ropeproject
│ │ └── config.py
│ ├── extensions.json
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
├── .vstest
│ ├── extensions.json
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
├── Create .venv pythonvirtual env here.txt
├── LICENSE.md
├── README.md
├── __app__
│ ├── .funcignore
│ ├── .python_packages
│ ├── __init__.py
│ ├── conftest.py
│ ├── host.json
│ ├── http_trigger_1
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ └── function.json
│ ├── http_trigger_2
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ └── function.json
│ ├── local.settings.SAMPLE.json
│ ├── requirements.txt
│ └── sharedcode
│ ├── __init__.py
│ ├── __pycache__
│ └── my_helper_functions.py
├── dev-requirements.in
├── dev-requirements.txt
├── mypy.ini
├── pytest.ini
└── tests
├── .pylintrc
├── __init__.py
├── testHttpTrigger1.http
├── testHttpTrigger2.http
├── test_http_trigger_1.py
└── test_http_trigger_2.py
