To follow along with the exercises which make up this workshop, you will need a few utilities installed on your system, including Python and an IDE.
To work with the code you will need a code editor. You are free to use any editor you like. Your instructor will use Visual Studio Code, an open source (OSS) editor from Microsoft.
The Visual Studio Code website will allow you to download and install Visual Studio Code.
The workshop presents a scenario where you will build a website using Flask, which is a lightweight Python framework.
To install Python, navigate to Python.org and follow the instructions.
NOTE If installing on Windows, ensure you select the option to add Python to your PATH system variable.
To ease creation of resources on Azure, this workshop uses the Azure CLI. By using the Azure CLI you are able to manage all Azure resources.
To install the Azure CLI, navigate to Azure CLI installation and follow the instructions. Beccause the Azure CLI is based on Python it will run on all operating systems.
Once installed, login to the Azure CLI by using az login. This operation will open a browser for authentication.
To download the starter and solution files, you will clone a repository from GitHub using git. Git is a distributed source code management system.
To install git, navigate to Git downloads and follow the instructions.
The sample code is provided as part of the Reactors repository on GitHub. Let's clone the repository and get the environment setup for the code.
- Open a command or terminal window
- Navigate to the folder you want to put the code into
- Clone the repository
git clone https://github.com/microsoft/reactors
- Navigate to the AI directory
# Windows
cd reactors\Artifical Intelligence 1_Building Software That Recognizes You\starter-site
# Linux or macOS
cd ./reactors/Artifical Intelligence 1_Building Software That Recognizes You/starter-site- Create a virtual environment and install packages Let's create a virtual environment for the packages we'll be using. Virtual environments allow us to separate packages from other environments. Return to the command line and issuing the following command:
# Windows
python -m venv env
.\env\Scripts\activate
# macOS or Linux
python3 -m venv env
. ./env/bin/activateNote: If you're using macOS or Linux the leading . for the . ./env/bin/activate is required as it indicates to Python where your source code resides.
- Install the necessary Python packages Install the packages listed in requirements.txt by using pip
pip install -r requirements.txt- Confirm the site starts
flask runNavigate to http://localhost:5000