Simple CRUD Implementation using Flask, SQLAlchemy running on uwsgi + nginx
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
- 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
- nginx <-> uwsgi ( 8080 )
- cuz nginx don't know python, uwsgi interpret request as middleware and send to flask app
- uwsgi <-> frontend_flask ( socket )
- flask app will process the request and send response
Clean Ubuntu
- Install Docker follow this guide
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
towanna_port:5000