Skip to content

[Question] This is very weird when i hosted my flet app on replit global variable showed up across devices #1930

Answered by plugeit
plugeit asked this question in Q&A
Discussion options

You must be logged in to vote

the flet dosen't starts a new instance for every device that get's connected to the flet website due to which global variables get shared to solve this problem i simply created a database and started storing global variables in dictionary which is stored in .txt file using eval function and for variables i created global variables using unique id
` def sb(key , value="pass", variable="pass"):
uinqueid=page.client_storage.get("user_unique_id")
if variable=="pass":
filename = "temp_user_data.txt"
with open(filename, "r+") as file:
# Get original data
original = eval(file.read())
# Seek to beginning
file.seek(0)
if value=="pass":
return original[uinqueid][key]
else:
file.truncate()
try:
orig…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by plugeit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
1 participant