0

I've got an Azure Linux Web App, and a custom deployment script deploy.sh

I have the Stack runtime version set to Python 3.6 in Application Settings.

I'm having trouble using Python 3.6 in the deployment script - if I use the SSH console I can run the command python3.6 and it works, if I use that in deploy.sh I get command not found.

I found Python 3.6 in /usr/local/python/3.6.6/bin so I tried using that in deploy.sh but got permissions errors trying to use /usr/local/python/3.6.6/bin/python3 -m pip install --upgrade pip, so I'm assuming that is not the version I am supposed to be using.

If I just use python in the script I get Python 2.7.

Md Farid Uddin Kiron
  • 16,817
  • 3
  • 17
  • 43
user3592246
  • 157
  • 2
  • 16
  • I suppose you need to do this: https://learn.microsoft.com/en-us/visualstudio/python/managing-python-on-azure-app-service?view=vs-2017? – 4c74356b41 Feb 12 '19 at 17:29
  • That link is for Windows apps - I have got it working fine on Windows web apps using Python extensions - but the same script ported to bash does not work on a Linux web app with Python runtime set, it runs the wrong Python version – user3592246 Feb 12 '19 at 17:34
  • Python on Windows apps is deprecated, they want you to use Linux instead, but Python on Linux is in "Preview" and is not production ready. OK then... – user3592246 Feb 12 '19 at 17:37
  • sorry, not aware of such intricacies :( – 4c74356b41 Feb 12 '19 at 18:46

1 Answers1

0

Using the Azure CLI, you can deploy a web app with Python 3.6 on Linux.

# az cloud set --name AzureCloud
# az login
# az account set -s 

RG="PY36TEST"
APPNAME=$RG-wp #Name what you want
LOCATION="WestUS" #put where you like

az group create -n $RG -l $LOCATION

# --sku {B1, B2, B3, D1, F1, FREE, P1, P1V2, P2, P2V2, P3, P3V2, PC2, PC3, PC4, S1, S2, S3, SHARED}
az appservice plan create -l $LOCATION -n $APPNAME-asp -g $RG --is-linux --sku S1

az webapp create -n $APPNAME -g $RG -p $APPNAME-asp --runtime "python|3.6"
Ken W - Zero Networks
  • 3,533
  • 1
  • 13
  • 18