Python Flask paginate error:paginated page returned 404 Python Flask paginate error:paginated page returned 404 flask flask

Python Flask paginate error:paginated page returned 404


This error happens when you request a page number that is higher than the number of pages existent with the filtered results. In this case, you're requesting page number 2, with "l.paginate(page, per_page=50, error_out=True)" (page=2) when in fact the number of results is less or equal than 50, so you only get one page.

This is a common mistake, the ui is requesting a page number higher than the existent. On every search, you got to reset the page to 1.

Look the image below, the behavior is the same (but I got the flag error_out=False so the pagination return the results with the items empty even though I get 6 items with the search).

enter image description here