App Engine 开发服务器在更改时不会重新加载代码

发布于 2024-10-29 02:21:47 字数 496 浏览 1 评论 0原文

我正在开发一个将在 Google App Engine 上运行的 python 应用程序。我使用以下目录结构设置我的应用程序:

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

...etc...

我的问题是,当我进行更改时,开发服务器并不总是自动重新加载我的代码,即使 Google 的文档说它会。

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

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

有没有补救办法,或者我只是做错了?我真的很喜欢拥有一个组织良好的项目,并且不想将所有文件转储到顶级目录中。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光清浅 2024-11-05 02:21:47

重新加载机制可能与默认导入机制和内置 __import__ 函数相关。如果您(或您的框架)以某种其他巧妙的方式加载模块,重新加载器可能不会注意到。一种可能的解决方法是在 myapp.py 模块中显式导入关键模块。

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.

梦里人 2024-11-05 02:21:47

仔细检查你是否已经安装了 pyobjc,

开发服务器会这样抱怨:

UserWarning: Detecting source codechanges not support because your Python version does not include PyObjC (http://pyobjc.sourceforge.net/)。请安装 PyObjC,或者如果不可行,请在 http: //code.google.com/p/appengine-devappserver2-experiment/issues/list

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文