Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ The dev container configuration lets you open the repository in a [GitHub codesp
- Python
- Running `pip install -r requirements.txt` from the project at container start.
- PostgreSQL
- Redis
- [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/overview) (so you can run `azd` commands directly).
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/azure/azure-dev/azd:latest": {}
},
},
"customizations": {
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
Expand All @@ -14,7 +14,8 @@
"ms-python.python",
"ms-python.vscode-pylance",
"mtxr.sqltools",
"mtxr.sqltools-driver-pg"
"mtxr.sqltools-driver-pg",
"GitHub.copilot"
],
"settings": {
"sqltools.connections": [
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/python-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ jobs:
DBHOST: localhost
DBUSER: postgres
DBPASS: postgres
SECRET_KEY: flask-insecure-key-${{ github.run_id }}-${{ github.run_attempt }}
81 changes: 81 additions & 0 deletions .github/workflows/starter-no-infra_web3-hotel-krivamar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions

name: Build and deploy Python app to Azure Web App - web3-hotel-krivamar

on:
push:
branches:
- starter-no-infra
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout

steps:
- uses: actions/checkout@v4

- name: Set up Python version
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Create and start virtual environment
run: |
python -m venv venv
source venv/bin/activate

- name: Install dependencies
run: pip install -r requirements.txt

# Optional: Add step to run tests here (PyTest, Django test suites, etc.)

- name: Zip artifact for deployment
run: zip release.zip ./* -r

- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v4
with:
name: python-app
path: |
release.zip
!venv/

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: python-app

- name: Unzip artifact for deployment
run: unzip release.zip


- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_EB9DA3824EFE47CD85819EB7185C6CEE }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_585414977F2D4BC3A05AE4A7A1384849 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_BF0EEB52860944129C22EDD6B5D8E130 }}

- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: 'web3-hotel-krivamar'
slot-name: 'Production'

3 changes: 0 additions & 3 deletions .vscode/README.md

This file was deleted.

25 changes: 0 additions & 25 deletions .vscode/launch.json

This file was deleted.

6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ def star_rating(id):
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/vnd.microsoft.icon')

if __name__ == '__main__':
app.run()
# add port 8000
#if __name__ == '__main__':
# app.run(host='0.0.0.0', port=8000)
34 changes: 0 additions & 34 deletions azure.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions azureproject/production.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

DATABASE_URI = 'postgresql+psycopg2://{dbuser}:{dbpass}@{dbhost}/{dbname}'.format(
dbuser=os.getenv('AZURE_POSTGRESQL_USER'),
dbpass=os.getenv('AZURE_POSTGRESQL_PASSWORD'),
dbhost=os.getenv('AZURE_POSTGRESQL_HOST'),
dbname=os.getenv('AZURE_POSTGRESQL_NAME')
)
DATABASE_URI = 'postgresql+psycopg2://{dbuser}:{dbpass}@{dbhost}/{dbname}'.format(
dbuser=os.getenv('AZURE_POSTGRESQL_USER'),
dbpass=os.getenv('AZURE_POSTGRESQL_PASSWORD'),
dbhost=os.getenv('AZURE_POSTGRESQL_HOST'),
dbname=os.getenv('AZURE_POSTGRESQL_NAME')
)
3 changes: 0 additions & 3 deletions infra/README.md

This file was deleted.

Loading