patchie
patchie

Reputation: 664

How are you supposed to install a Python library using azure webapp as template?

I have access to the Azure Portal.

From there, i have setup a free so called "webapp" using the FlaskAzure(python) template. (https://github.com/azureappserviceoss/FlaskAzure)

I have installed MS Visual Studio 2015(with "python tools"), and MS Visual Studio 2017RC(which doesn't have python support just yet).

I want to install a library called "docx".

My question is: How am i supposed to install new libraies? It might be possible to install it in several ways, as i also have access to kudu with terminal access. I just wonder if i actually have to use the terminal, or if i can use the MS VS2015 with python tools to do this, and how?

Upvotes: 2

Views: 4520

Answers (2)

patchie
patchie

Reputation: 664

The fix was actually to create a new webapp from scratch without flask and python. It has to be a regular webapp.

Then to add python as an extension.

As far as I have understood, this is because there is some changes going on with the python/flask webapps, and there will be a fix for this later on.

After I installed as described the link, it seems to work: https://web.archive.org/web/20190111131654/https://prmadi.com/running-flask-app-with-httpplatformhandler-in-azure-app-services/

It was a bit hard to understand it all from the tutorial, but if you have problems create a support ticket within the azure portal, as they will guide you through the guide.

Upvotes: 0

4c74356b41
4c74356b41

Reputation: 72191

Just create a requirements.txt in the root of the project, when the build is going to be deployed, kudu will detect that file, scan it and try installing those packages automatically during deployment.

you can create requirements.txt with pip freeze > requirements.txt

Take a look at this article: https://blogs.msdn.microsoft.com/azureossds/2015/06/29/install-native-python-modules-on-azure-web-apps-api-apps/

Upvotes: 1

Related Questions