How to I save data to the back end on flask when using nignx to host my site live

Posted October 4, 2019 375 views

I have a couple buttons that upon clicking adds or deletes data from an array stored on the flask app. This serves as a database of sorts. Everything works fine when testing it locally, but when I host my site live using nignx, it doesn’t seem to save the data right. If I refresh the page it’ll pull a different instance of the data each time. How do I make sure it only refreshes the most recent data?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

This sounds like you are storing the data in a dictionary, which is unsorted by default. What you might need to do is update your query code to search through the dictionary for the latest key value that you desire OR to update the code using something like OrderedDict, which is available via the collections module.

If you need more pointers or I am misunderstanding the issue, please provide more details about the code and use case :) Good luck!