A_toaster
A_toaster

Reputation: 1288

How do you pip install libraries to the 'antenv' venv on an Azure Web App?

I am trying to deploy a Flask app to an Azure Web App (Linux, python3.7 runtime) using FTP.

I copied the "application.py" over and a "requirements.txt", but I can see in the logs that nothing is being installed.

The Web App is using an 'antenv' virtual environment but it won't install anything. How do I add libraries to this 'antenv' virtual environment?

Upvotes: 2

Views: 5534

Answers (2)

AjayKumar
AjayKumar

Reputation: 3183

Yes, I see that you have resolved the issue. You must use Git to deploy Python apps to App Service on Linux so that your dependencies in requirements.txt are installed (root folder).

To install Django and any other dependencies, you must provide a requirements.txt file and deploy to App Service using Git. The antenv folder is where App Service creates a virtual environment with your dependencies. If you expand this node, you can verify that the packages you named in requirements.txt are installed in antenv/lib/python3.7/site-packages. Refer this document for more details.

Additionally, Although the container can run Django and Flask apps automatically, provided the app matches an expected structure, you can also provide a custom startup command file through which you have full control over the Gunicorn command line. A custom startup command is typically required for Flask apps, but not Django apps.

Upvotes: 3

A_toaster
A_toaster

Reputation: 1288

Turns out I had to run these commands and do a git push while my local venv was activated. At that point I saw azure start downloading all the libraries in my requirements.txt

Upvotes: 0

Related Questions