How to specify postgres DB parameters during Github Action Python build for Azure?

I have a Django web application I'm trying to deploy to Azure. I'm following this tutorial on how to set up the project. During the build I'm trying to run migrations on the DB, with the following command:

  WEBSITE_HOSTNAME: 'something'
  DBHOST: ${{ secrets.DBHOST }}
  DBNAME: ${{ secrets.DBNAME }}
  DBUSER: ${{ secrets.DBUSER }}
  DBPASS: ${{ secrets.DBPASS }}
  DBPORT: ${{ secrets.DBPORT }}

    runs-on: ubuntu-latest

  - uses: actions/checkout@v2

  - name: Set up Python version
    uses: actions/setup-python@v1
      python-version: '3.10'

  - name: Create and start virtual environment
    run: |
      python -m venv venv
      source venv/bin/activate
  - name: Install dependencies
    run: pip install -r requirements.txt

  - name: Make migrations and run migrations
    run: python ./appname/ migrate

However, this step fails with the following error:

 django.db.utils.OperationalError: could not translate host name "***.***" to address: Name or service not known

I'm referring to these values in the like this:

hostname = os.environ['DBHOST']
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': os.environ['DBNAME'],
        'USER': os.environ['DBUSER'],
        'PASSWORD': os.environ['DBPASS'],
        'PORT':  os.environ['DBPORT'],
        'HOST': hostname + "" if 'WEBSITE_HOSTNAME' in os.environ else os.environ['DBHOST'] 

I have inserted the DBNAME, DBHOST, etc. values shown on the screenshot as app secrets into github, so I'm really not sure why it is not finding them. Can anyone point out please what am I missing here?

enter image description here

Back to Top