Я следовал этому руководству по Microsoft , используя CLI для создания Azure -функции в python.
Затем я создал вторую функцию, обе 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
В терминале Powershell я могу запускать обе функции следующим образом ...
(.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
...
Я могу использовать http ie для запуска обеих функций по мере необходимости.
THE ПРОБЛЕМА - Как интерактивно отлаживать в VS-коде?
Когда я сейчас открываю файлы в VS Code для одной функции, я могу затем нажать F5, чтобы запустить команду для отладки и пройти через событие Trigger и выясните, в чем проблема.
Какую конфигурацию мне следует использовать для запуска обеих функций, чтобы я мог устанавливать точки останова и интерактивно отлаживать в VS-коде? Я использую Windows 10.
Направление для решения
Я настроил образец шаблона github repo https://github.com/rnwolf/azure-func-python-layout с результатами моего исследования, которые вы могли бы использовать в качестве стартера для ваших Azure функций.
Схема, которая работает для меня, приведена ниже. Обязательно откройте VSCode в каталоге root, multi3, в приведенном ниже примере. Я обнаружил, что вы можете удалить .vscode и .vstest, а затем VSCode выясняет, как установить некоторые допустимые значения по умолчанию.
(.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