App Engine开发服务器在更改时不会重新加载代码 [英] App Engine Development Server Does Not Reload Code When Changed

查看:109
本文介绍了App Engine开发服务器在更改时不会重新加载代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究可在Google App Engine上运行的python应用程序。我安装了以下目录结构的应用程序:

  approot / 
app.yaml
索引。 yaml
myapp.py
控制器/
some_controller.py
some_controller1.py
模型/
views /

.. .etc ...

我的问题是开发服务器不会总是在我自动重新加载我的代码时尽管Google的文档说明它会做出更改。



重新加载我的代码的唯一时间是当我所做的更改位于我的应用程序的顶级目录中时。子目录中的任何内容(例如控制器)都会被忽略。每次进行更改时,我都必须停止并启动服务器。



我发现这确实阻碍了我的开发进度,特别是因为没有重新启动按钮,必须先停下来然后开始。



有没有补救措施或我只是做错了?我真的很喜欢有一个组织良好的项目,而不是将我的所有文件都转储到顶层目录中。 重载机制可能与默认导入机制和内置 __ import __ 函数有关。如果你(或者你的框架)以其他聪明的方式加载你的模块,那么这个reloader可能不会注意到。可能的解决方法是在 myapp.py 模块中显式导入关键模块。


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.

解决方案

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.

这篇关于App Engine开发服务器在更改时不会重新加载代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆