Progress monitoring using Django model is not syncronized (One writer and multiple readers)
===

I am implementing a progress monitoring function using Django. However, I cannot get the updated value in the front end.

A Django management command is executed by `popen` to keep updating the progress of a `webscan`. Scan is a Django model and `progress_info` is an attribute of the model which is saved in database. The code is as follows:

                d = 10
                while (d) :
                    time.sleep(10)
                    try:
                        isBusy = server.call("framework.busy?")
                        logging.debug(isBusy)
                        if isBusy.strip() == 'true':
                            progress = webscan.progress
                            webscan.progress_info = progress
                            webscan.save()
                            logging.debug("%s"%progress)
                        else:
                            d = 0
                    except Exception as e:
                        logging.debug("In an exception when calling busy. Exception: %s and Type %s"%(e, type(e)))
                        d -= 1

In the front-end, I make an ajax call to get the value of `progress_info`. The handler simply get the value of `webscan.progress_info`and returns it to the front-end. The code is as follows:

    @property
    def get_progress(self):
        return self.progress_info

Using the GUI of the DB, I can see that the value of progress_info is kept updated. However, the ajax call keeps returning `0` to the front-end until the command finishes (0 is the initial value of `progress_info`).

I guess it is because of the locking mechanism of DB or Django but do not fully understand. Could anyone help me with it? Thanks a lot~