I am attempting to recreate this website: https://what-to-code.com/ using flask and flask-SQLAlchemy. However I have run into a problem. I want each user of the website to only be able to like a post once, which would be easy to do if each user was required to make an account. But I would like to have a completely anonymous system. I have thought of two ways to achieve the like counter but I can't figure out how to implement them.
Every time a new IP address connects to the website, create a user in the sqlite database I am using, and when the user tries to like a post, check to see if their IP already exists in the liked users.
Somehow assign a cookie to each user that connects, that keeps track of their likes. Upon inspection of the website's cookies, I see this is the approach they have taken.
I recognise that these systems both have flaws and can be exploited, but I don't mind that.
How could I achieve this anonymous liking system with flask and flask-SQLAlchemy?
Thank you.