The code is ridiculously messy with unnecessary functions etc. plus when I tried to follow your tutorial you haven't even linked the next part of the tutorial so I don't know how anyone else has followed along TBH!
It would seem you don't actually know how to create flask apps properly.
I will just re-code from scratch ... thanks but no thanks