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
63 changes: 63 additions & 0 deletions .github/workflows/deploy_we-chat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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 - we-chat

on:
push:
branches:
- deploy
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python version
uses: actions/setup-python@v1
with:
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

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

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

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

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

- name: 'Deploy to Azure Web App'
uses: azure/webapps-deploy@v2
id: deploy-to-webapp
with:
app-name: 'we-chat'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_CDF3B4DE7D12465F85761BD9A67FA7E3 }}
4 changes: 2 additions & 2 deletions application.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Configure App
app = Flask(__name__)
app.secret_key = os.environ.get('SECRET')
app.secret_key = os.environ.get('SECRET_KEY')

#Configure database
app.config['SQLALCHEMY_DATABASE_URI']= os.environ.get('DATABASE_URL')
Expand Down Expand Up @@ -115,4 +115,4 @@ def leave(data):


if __name__ =="__main__":
app.run()
app.run()
7 changes: 5 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from enum import unique
from flask_sqlalchemy import SQLAlchemy
from flask_login import UserMixin
from flask import Flask

db = SQLAlchemy()
app = Flask(__name__)

db = SQLAlchemy(app)

class User(UserMixin, db.Model):
"""User Model"""
Expand All @@ -11,4 +14,4 @@ class User(UserMixin, db.Model):
username = db.Column(db.String(25), unique=True, nullable=False)
password=db.Column(db.String(), nullable=False)


# db.create_all()