/training-flask

The Python micro framework for building web applications.

Primary LanguagePython

Flask

Flask is a Python micro framework for building web applications.

Local Development

Requirements

  • terminal
  • git
  • python3

How get this running

  • Clone this repository
  • Change directory
  • Create new virtualenv
  • Activate virtualenv
  • Install required Python packages (into the virtualenv)
  • Run Flask application
  • Access service via HTTP
  • Fun&Freizeit

Examples

Windows

git clone https://github.com/cbwham/training-flask.git
cd training-flask
python -m venv .venv
.venv\Scripts\activate.bat
pip install -U -r requirements.txt
flask run

Linux, MacOS

Just the activation of the virutalenv is different:

. .venv/bin/activate # https://linuxize.com/post/

Cloud: Azure

Prerequisite

To begin please install the Azure CLI and succeed to logging in:

az login

Deploy to Azure

Please read the according documentation first!

az webapp up --location germanywestcentral --name cbwham-training-flask --runtime PYTHON:3.11 --sku B1 --generic-configurations '{"healthCheckPath": "/healthcheck"}' --only-show-errors

Note: name needs to be unique Azure-wide!

Example Output

{
  "URL": "http://cbwham-training-flask.azurewebsites.net",
  "appserviceplan": "office_asp_3158",
  "location": "germanywestcentral",
  "name": "cbwham-training-flask",
  "os": "Linux",
  "resourcegroup": "office_rg_5180",
  "runtime_version": "PYTHON|3.11",
  "runtime_version_detected": "-",
  "sku": "BASIC",
  "src_path": "//Users//gretel//Sync//code//cbwham//training-flask"
}

Connect

According to the output the web application should now be reachable at:

https://cbwham-training-flask.azurewebsites.net/