Skip to content

jesschannn/flask_e2e_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flask_e2e_project

Overview

This repository is my HHA 504 Final Project, which contains code that allows users to view data about medical malpractice statistics displayed on a web application, as well as educate users on what medical malpractice is.

Technologies Utilized

Technologies used were Flask, Tailwind, MySQL Database on Azure, SQLAlchemy, API service via Flask, Google OAuth, Sentry,io, Docker, and Azure.

  • Flask: web development (backend)
  • Tailwind: front-end styling
  • MySQL Database on Azure: data storage
  • SQLAlchemy: database interaction
  • Google OAuth: authorization
  • Sentry.io: error monitoring
  • Docker: containerization
  • Azure: deployment

Deployment Steps

How to Run Without Docker Locally

If an individual wanted to run my code locally without Docker, they would have to clone my app.py, templates folder, requirements.txt, .env, .gitignore, static folder, and oauth folder (everything in the app folder). Then the individual would have to cd into their on workspace, cd into the app folder, and run python app.py in their console.

image

How to Run With Docker Locally

If an individual wanted to run my code locally with Docker:

  1. Clone my entire app folder.
  2. Create a Docker file with the following lines:
FROM python:3.7-alpine
WORKDIR /app
COPY . /app
RUN pip install -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]
  1. Docker build: docker build -t <name>
  2. View the image: docker images
  3. Run Docker: docker run -d -p <port you want to run it on>:<port exposed> <name>
  4. Display information about Docker containers: docker ps
  5. Stop the Docker image from running: docker stop <container id>
  6. Delete Docker image: docker system prune -a -f

image

How to Deploy to Cloud

If an individual want to deploy my code onto the Cloud:

  1. Install Azure CLI: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
  2. Log in: ``az login --use-device-code```
  3. Create a resource group: az group create --name <name of resource group> --location eastus
  4. Deploy the Azure App Service: az webapp up --name <name of app service> --sku B1 --runtime "PYTHON | 3.9" --resource-group <resource group name>
  5. Click on the link provided in the console

image

Template of the .env File

DB_URL= ***
DB_HOST= ***
DB_DATABASE= ***
DB_USERNAME= ***
DB_PASSWORD= ***
DB_PORT= ***
DB_CHARSET= ***

GOOGLE_CLIENT_ID= ***
GOOGLE_CLIENT_SECRET= ***

Screenshots

Screenshots of Web Application (Local)

image image image image

Screenshots of Google OAuth

image image

Screenshot of SQL Workbench

image

Screenshot of SQL Database - Azure

image

Screenshot of API Endpoint

image

Screenshot of Error Endpoint

image

Screenshot of Sentry.io

image

Screenshot of Docker

image

Screenshot of Azure Deployment

image