Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robmarkcole/simple-fastapi-webapp
Use fastAPI to generate html web app that will serve a local directory or S3 bucket of images
https://github.com/robmarkcole/simple-fastapi-webapp
fastapi
Last synced: about 1 month ago
JSON representation
Use fastAPI to generate html web app that will serve a local directory or S3 bucket of images
- Host: GitHub
- URL: https://github.com/robmarkcole/simple-fastapi-webapp
- Owner: robmarkcole
- License: apache-2.0
- Created: 2021-01-18T04:52:30.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-18T08:44:19.000Z (about 4 years ago)
- Last Synced: 2024-12-24T20:01:59.434Z (about 1 month ago)
- Topics: fastapi
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 11
- Watchers: 2
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-fastAPI-webapp
Use fastAPI to generate html web app that will serve a local directory or S3 bucket of image thumbnails and metadata, and provide links to the full sized images which can be downloaded. The endpoints can also be accessed programmatically via a rest API. Docker, python and fastAPI are the core technologies. Minimalism is preferred over a shiny interface, and it must be easy to put into production.Why [fastAPI](https://fastapi.tiangolo.com/) over flask? Read [this article](https://amitness.com/2020/06/fastapi-vs-flask/) for a detailed intro to the topic, but for me the big advantages are built in type validation, auto generated docs, and less boilerplate.
## Docker build and run
```
docker build -t webapp .
docker run -p 8000:8000 webapp:latest
```
Then visit [http://127.0.0.1:8000/](http://127.0.0.1:8000/). The docs are at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs).## Development in venv
- `python3.7 -m venv venv`
- `source venv/bin/activate`
- `pip3 install -r requirements.txt`
- `uvicorn main:app --reload`
- [http://127.0.0.1:8000/](http://127.0.0.1:8000/)## References
- https://fastapi.tiangolo.com/advanced/custom-response/ -> fastAPI HTML docs
- https://eugeneyan.com/writing/how-to-set-up-html-app-with-fastapi-jinja-forms-templates/ article and [code](https://github.com/eugeneyan/fastapi-html)
- https://haltakov.net/simple-photo-gallery/ -> flask app for serving image thumbnails as html app
- [File Management with AWS S3, Python, and Flask](https://stackabuse.com/file-management-with-aws-s3-python-and-flask/) -> flask app for uploading and downloading files to S3, with [code](https://github.com/ro6ley/flask-drive)
- https://github.com/robmarkcole/text-insights-app/tree/master/tesseract-engine -> fastAPI in docker