Skip to content
63 changes: 63 additions & 0 deletions .github/workflows/permissions_invmanagecollegeclubsparth.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 - InvManageCollegeClubsParth

on:
push:
branches:
- permissions
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.9'

- 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: 'InvManageCollegeClubsParth'
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_6943D8B980754E21BBAAEE39A01C9B24 }}
11 changes: 9 additions & 2 deletions Inventory_Management/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('SECRET_KEY_InvManage')
SECRET_KEY = 'django-insecure-n%soswvt@-)o2@i_q5q%6=gkh)tkl)y6o*_1-s-b9n#+fw5(@y'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False

ALLOWED_HOSTS = ['inv-manage-college-clubs.herokuapp.com/', '127.0.0.1']
ALLOWED_HOSTS = ['inv-manage-college-clubs.herokuapp.com', '127.0.0.1', 'localhost', 'inv-manage-clubs-parth.azurewebsites.net/']


# Application definition
Expand All @@ -44,6 +44,7 @@

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
Expand Down Expand Up @@ -120,7 +121,13 @@
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]
STATIC_URL = '/static/'
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"

#Managing Mailing
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
Expand Down