Miguel Grinberg had wrote an excellent tutorial series on developing a full stack web application system using the Flask framework.
His system has the reader learn and utilize several components, including Elasticsearch, Redis, RQ and SQLAlchemy.
The system is called Microblog.
The maintainer of this repository had expanded on Miguel's excellent work:
- This Microblog will use LibreTranslate to provide translation services to users.
- This Microblog has all translation queries served internally.
- Miguel's original tutorial has the reader use an external translation API
- This Microblog provides a stand-alone
docker-compose.yml
, which allows for easy deployment of the full stack system.- The only other file needed by users to bring up Microblog is a configuration file.
- Chapter 23 is about adding a RESTful API to Microblog, but Miguel only shows the implementation for Users, and he leaves the remaining endpoints as an exercise for the reader. The following additional endpoints have been implemented here:
/api/posts
: read one post, read all posts, publish new post./api/messages
: read one message, read all messages, send new message -- authentication/authorization enabled so that users may only see messages to or from them./api/notifications
: read one notification, read all notifications -- authentication/authorization enabled so that users may only see notifications for them, and noPOST
method is defined because there's no need for a client to submit a notification./api/tasks
: read one task, read all tasks, submit new task -- authentication/authorization enabled so that users may only see tasks they own. An error will be returned if a client submits the same task twice. The methodUser.launch_task()
is used, just like on the HTML side inroutes.py
.
- Install Docker, Docker Desktop or Podman,
- Download
docker-compose.yml
, - Download
.env.example
,- Rename it to
.env
, and then, - Place it into the same directory as
docker-compose.yml
,
- Rename it to
- Using a terminal,
cd
to the directory containing bothdocker-compose.yml
and.env
, and run:docker compose up
- Wait about 15 minutes (or longer) for:
- All images to download (the LibreTranslate image is large),
- After the LibreTranslate container starts, it takes about 10 more minutes before it will begin serving translation requests,
- Using a web browser, access the service on standard HTTP port
80
!- For example, http://localhost/
There is an original README.old.md
which was used by the maintainer of this repository while following Miguel's tutorial. That README.old.md
has notes which, ultimately, have been translated into the run.sh
, Dockerfile
, docker-compose.yml
, and more.
The original tutorial was written by Miguel Grinberg. All the code in this repository was physically typed on a keyboard by ultasun while following Miguel's tutorial.
Thanks Miguel! Thank you for reading.