Reputation: 33
I hope someone can clarify this for me:
Does the GAE dev server also cache the Python global scope like the production server does? I'm under the impression that it does not. I can't find anything about this in the docs.
Thanks
Quint
Upvotes: 1
Views: 221
Reputation: 2275
Yes, it does. But when you change code, the development server restarting and you have brand new namespace for your modules.
Python doesn't have "global scope" (like e.g. PHP has) between modules. It has namespaces. They are mostly modules namespaces (created when you do imports) and, as you know, GAE caching imports. This cache is alive while the instance is running. Instance in general is a python's process and python keep variables values in memory until there is at least one reference to them.
Since the development server simulates the production service, it works in the same way, but the difference is that devserver watches for changes you make to your files (and I notice not only files) and reloads them if needed. To guaranteed reset module import caching you also need to restart server like in production.
Upvotes: 1