Azure / Azure/actions-workflow-samples

Deploy derived from template runs succesful, still ModuleNotFoundError on Azure Web App

Open
#60 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Pug
Stars
511
Forks
657
PR merge metrics
No merged PRs in 30d

Description

I use the given [template](https://github.com/Azure/actions-workflow-samples/blob/master/AppService/python-webapp-on-azure.yml) for deploying to Azure Webapp through GH actions. Everything runs fine, but I still get ModuleNotFoundError when trying to access my website. My yaml:

```yaml
name: My App
on:
push:
branches:
- main
env:
AZURE_WEBAPP_NAME: my-app
AZURE_WEBAPP_PACKAGE_PATH: '.'
PYTHON_VERSION: '3.8' # supports 3.6, 3.7, 3.8)
jobs:
build-and-deploy-to-Azure:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@master
- name: Setup Python ${{ env.PYTHON_VERSION }} Environment
uses: actions/setup-python@v2
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: 'Install dependencies'
run: |
python -m pip install --upgrade pip
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github".insteadOf https://github
pip install -r requirements.txt
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
```

But when I look in the log stream in our app, I see:

```commandline
2021-02-15T16:51:47.899495269Z File "/home/site/wwwroot/app.py", line 1, in
2021-02-15T16:51:47.899499469Z from sampling_app import app
2021-02-15T16:51:47.899503270Z File "/home/site/wwwroot/sampling_app/__init__.py", line 2, in
2021-02-15T16:51:47.899507570Z from flask_login import LoginManager
```

But the module is definitely installed, when I look in the logs of GH actions:
```commandline
Successfully installed Faker-6.1.1 Flask-1.1.2 Flask-Bcrypt-0.7.1 Flask-Bootstrap-3.3.7.1 Flask-Cors-3.0.10 Flask-Dropzone-1.5.4 Flask-Login-0.5.0 Flask-Mail-0.9.1 Flask-SQLAlchemy-2.4.4 Flask-WTF-0.14.3 Jinja2-2.11.3 MarkupSafe-1.1.1 SQLAlchemy-1.3.23 Six-1.15.0 WTForms-2.3.3 Werkzeug-1.0.1 bcrypt-3.2.0 blinker-1.4 cffi-1.14.5 click-7.1.2 dnspython-2.1.0 dominate-2.6.0 email-validator-1.1.2 et-xmlfile-1.0.1 idna-3.1 itsdangerous-1.1.0 jdcal-1.4.1 numpy-1.20.1 openpyxl-3.0.6 pandas-1.2.2 pycparser-2.20 pyodbc-4.0.30 python-dateutil-2.8.1 python-dotenv-0.15.0 pytz-2021.1 steekproef-0.0.1 text-unidecode-1.3 visitor-0.1.3 xlrd-2.0.1 xlsxwriter-1.3.7
```

What am I missing here? I hope I dont have to use `azure/appservice-build@v2`, because that way I am not sure how to install our pivate repo's, notice the line in our YAML:
```commandline
git config --global url."https://${{ secrets.ACCESS_TOKEN }}@github".insteadOf https://github
```

We use an ACCES_TOKEN to access our private repos in our CD.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.