简体   繁体   中英

In PyCharm, webpages refresh in debug mode, not in run mode

I'm writing a GAE webapp using Python 2.7, webapp2, and Jinja. In development, I run the app under PyCharm 2.7.1 on a Max OSX 10.7.5 (Lion). I'm currently using Chrome 26.0.1410.43 as my browser.

I don't know for sure that this is a PyCharm issue, but that's my best guess. Here's a description:

When I use the "Debug" control to start the app, webpages refresh automatically as I navigate from one page to another. That is, if I start at page A, navigate to page B, take some action that changes what A should look like, and navigate back to A, the change appears.

However, when I use the "Run" control to start the app, with no other changes, webpages do not automatically refresh. In that same scenario, when I navigate back to A, the old version of that webpage appears. I need to click my browser's Refresh control to see the updated page.

Please tell me how to stop the browser from displaying cached pages in Run mode. I haven't tried publishing this to our GAE website yet, and hopefully it won't happen there, but I need Run mode for performance on the video tutorial I'm creating.

Thanks for any suggestions!

It turns out that this wasn't a refresh or caching issue but a timing issue. Under some circumstances, GAE uses an update algorithm that incurs a delay before transactions are applied. In Run mode, the new page was being requested before the update was completed; in Debug mode, enough time passed for the update to be completed.

One solution would have been to change the datastore architecture to eliminate reading an obsolete version of the data, but that caused other, more serious problems.

Another solution was to include a split-second delay, after an update but before displaying the updated record. Not ideal, since it's impossible to know how long that delay has to be, but for now this has been satisfactory.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM