App Engine Development Server Does Not Reload Code When Changed

1.4k Views Asked by At

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.

2

There are 2 best solutions below

4
On BEST ANSWER

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.

0
On

double check that you have installed pyobjc

the dev server will complain like this:

UserWarning: Detecting source code changes is not supported because your Python version does not include PyObjC (http://pyobjc.sourceforge.net/). Please install PyObjC or, if that is not practical, file a bug at http://code.google.com/p/appengine-devappserver2-experiment/issues/list.