I'm using a Django framwork, and have to pass new query to a python script. However, that python program have to read a large data file, and it takes 2 minutes to load the data. So I want to load the data only once, and just pass new query to the running python program, then it will be fast enough for web users. Unfortunately, I have searched a lot, but still don't know how to implement it.
One method is to read a communication file:
oldid = -1
while True:
f = open("communication","r")
t = f.read()
f.close()
t = t.split("==")
id = int(t[0])
query = t[1]
if id > oldid:
# the query was not handled yet
stuff to handle your query ...
oldid = id
You write a file which looks so: ID==QUERY Replace id and query with your wishes. Count id +1 if you push a new query. You could use a script for that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.