Skip to content

l0vey0u/flask-crud-application-with-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask Web APP running on Docker container

Simple CRUD Implementation using Flask, SQLAlchemy running on uwsgi + nginx

Flask app

Simple board showing the number of confirmed cases using user input data

Endpoints

  • /
    • redirect read except having no data ( redirect insert at having no data )
  • /read/
    • show data list from database
    • if data list has no data, redirect to insert
  • /insert/
    • insert data to database
    • can batch input to upload csv file
  • /edit/<date>?count=value
    • no page layout but can use request url that like below format
    • localhost/edit/2020-10-01?count=64
  • /remove_all_data/
    • CAUTION
    • Delete all rows at DailyConfirmed and UploadedFile Table with delete uploaded csv file
    • after delete redirect insert
    • I recommend that disable end point at non debug
  • /upload/
    • handle upload file
    • insert real file name to database with file checksum ( Cuz Duplicate File ) and use row idx to save name
  • /export/
    • no page layout but can use request url that like below format
    • localhost/export

Docker Container Orchestration

  1. external request <-> nginx ( proxy ) ( 8099 to 5000 )
  • Nginx Recieve Request
  • Return Response if request was about cached data or static file
  • if Not send request to uwsgi
  1. nginx <-> uwsgi ( 8080 )
  • cuz nginx don't know python, uwsgi interpret request as middleware and send to flask app
  1. uwsgi <-> frontend_flask ( socket )
  • flask app will process the request and send response

Reference

Usage

Clean Ubuntu

Clean Ubuntu with docker ( like github codespace )

  • execute ./install_docker-compose.sh

Docker compose

  • docker-compose up -d --build
  • After docker container orchestration, Can access Flask web app to localhost:8099

Check logs

  • docker logs container_name

Customize Portforward

  • change ports value at backend service in docker-compose.yml
    • - 8099:5000 to wanna_port:5000

About

Simple CRUD Server Implemented using Flask, Mysql, SQLAlchemy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published