Search code examples
pythongoogle-app-enginesdkdevserver

App Engine Development Server Does Not Reload Code When Changed


I'm working on a python app that will run on top of Google App Engine. I setup my app up with the following directory structure:

approot/
  app.yaml
  index.yaml
  myapp.py
  controllers/
   some_controller.py
   some_controller1.py
  models/
  views/

...etc...

My problem is that the development server will not always automatically reload my code when I make changes even though Google's documentation says it will.

The only time it does reload my code is when the change I make is in the top level directory of my app. Anything in a subdirectory (e.g. controllers) is ignored. I have to stop and start the server every time a change is made.

I find this really impedes my progress in development, especially since there is no restart button, you actually have to hit stop and then start.

Is there a remedy for this or am I just doing it wrong? I really like having a well organized project and would rather not dump all my files in the top level directory.


Solution

  • The reload mechanism is likely tied to the default import mechanism and builtin __import__ function. If you (or your framework) load your modules in some other, clever way, the reloader might not notice. A possible workaround is to explicitly import key modules in your myapp.py module.