I am following the Flask Mega-Tutorial which implements a kind of Post functionality with Create/Update/Delete happening on separate pages. However, i would like to try to make some kind of Facebook Wall type of posting where it is possible to create, comment, edit and delete posts directly on the "post" page. If at all possible, are there any templates/resources/guides/tutorials etc. for how to go about making this or could anyone provide me with some pointers for how to do this with Flask and Bootstrap?
1 Answers
The tutorial you follow might not be the best for your goal. To achieve something similar to one page where you can create/edit/delete posts like a "wall" then you could do it if you implement a JSON interface between your frontend and your backend and then make request with HTTP POST (to create a new post), HTTP PATCH (to edit a post) and HTTP DELETE (to delete a post). Then you can separate the rendering of the frontend from the backend function invocations and redraw only the parts of the page which need updated (inside a div) using an AJAX request from your frontend.
I found an article about this "Flask + REST API + JSON" when I searched for it https://medium.com/@gokhang1327/separate-front-end-from-back-end-with-flask-ajax-a5b22b12d001
This is how I would do it myself if I started this project today.

- 25,640
- 75
- 229
- 424