- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个 app.py flask 应用程序,我想为其启用自动重新加载。这是入口点:
APP = Flask(__name__)
APP.config.from_object(os.environ['APP_SETTINGS'])
# a lot of configurations ommited
if __name__ == "__main__":
APP.run(debug=True, port=5005)
当我运行应用程序时,我在终端中得到了这个:
/Users/George/myproject/venv/bin/python /Users/George/myproject/app.py
* Running on http://127.0.0.1:5005/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger pin code: 338-825-330
当我修改我的一个 Controller 时,它发现发生了变化:
* Detected change in '/Users/George/myproject/web_endpoints/user.py', reloading
但更改不会发生,如果我再做一次更改,它永远不会被拾取(不会在终端中报告)。
最佳答案
不建议 Flask 将 app.run() 与自动重新加载一起使用,因为它受到严重支持
这是Flask源码中的注释
def run(self, host=None, port=None, debug=None, load_dotenv=True, **options):
"""Runs the application on a local development server.
...
If you want to run the application in debug mode, but disable the
code execution on the interactive debugger, you can pass
``use_evalex=False`` as parameter. This will keep the debugger's
traceback screen active, but disable code execution.
It is not recommended to use this function for development with
automatic reloading as this is badly supported. Instead you should
be using the :command:`flask` command line script's ``run`` support.
...
"""
pass
但是你可以像这样强制使用重新加载器:
if __name__ == '__main__':
app.run(host=config.HOST, port=config.PORT, debug=True)
注意,app.run()
必须用 if __name__ == '__main__'
包裹。
关于python - Flask autoreload 不重新加载或拾取更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45089465/
@秋意正寒 先讲怎么用,再讲大致原理。 1 拾取坐标 > 仅拾取椭球体表面坐标 使用 Camera.prototype.pickEllipsoid 方法,接受一个必选的屏幕坐标,返回一个三维世界坐标
我知道 OpenGL 选择模式已被弃用,并且除了少数 SGI 盒和 3DLabs GPU 之外从未进行过硬件加速。但我无法摆脱它(不是我的代码)。在其 C++ 代码下方: void GLWidget:
我有一个 .ipa,里面有 arm64 和 armv7 个片段。如果我在同时支持 arm64 和 armv7 的 iDevice 上运行它,运行时将选择哪个切片? 我可以通过打印 NSLog 或某种方
我想在建模为高度图的世界地面上的 OpenGL 场景中跟踪鼠标坐标。目前没有像硬件镶嵌这样的花哨的东西。注意这个问题是不是 关于物体拾取。 目前我正在执行以下操作,由于回读操作,这显然会降低性能: 渲
我正在将一个数组从 php 传递到 javascript,但它似乎在数组的开头和结尾处拾取了一个额外的“。 我的数组从 PHP 文件发送 json_encode($CheckItems."|".$Ch
我的光线拾取代码有问题。我的代码 我正在使用此代码进行选择计算: /*----------------------------------------------------------- Funct
我需要根据特定深度(用于光线转换)将 2D 鼠标坐标转换为 3D 世界坐标。我没有直接在 C++ 中使用 DirectX,我使用的是专有语言,但如果你用 C++ 或伪代码(首选 C++)给我一个答案,
我正在开发一款等距游戏,但在制定方 block 选择算法时遇到了问题。 这就是我渲染等距 map 的方式: for (int x = 0; x < 50; x++) { for (int y
我尝试在应用程序中导出 UTI,但 macOS (10.3.2) 未拾取它。我已经在一个较小的项目中复制了我的问题。这是 info.plist 的相关部分: UTExportedTypeDeclara
我正在尝试使用 Pyglet 的 OpenGL 包装器实现拾取,但我在转换 C tutorial 时遇到了问题到 Python。具体在下面的部分。 #define BUFSIZE 512GLuint
我有一个定义为 singleTop 的 Activity,因此只有一个实例存在。 我用一些数据设置了一个 Notification Intent,并将其包含在 PendingIntent 中,
场景中有一些物体,有些可能会遮挡其他物体。当我单击鼠标或拖动选择以获得选择矩形时,我只想选择/拾取从这个角度可以看到的对象。应用程序当前使用 GL_SELECT 渲染模式,但正如我们所知,这也会选择被
我在一个小项目中使用了SpringBootApplication。架构很简单: 入口文件: @SpringBootApplication @PropertySource("classpath:appl
我有以下媒体查询,以选择 iPad 视网膜和更小的显示器。 @media only screen and (min-device-width : 768px) and (max-device-widt
我需要将 Oauth 设置为我将要处理的 PHP 项目的一部分。 为此我跑了; sudo pecl install oauth 这完成了 OK,它指示我将 extension=oauth.so 添加到
我正在尝试使用 Angular4 和 Google Analytics 集成自定义维度。我看过类似的主题,但没有任何内容可以准确解决这个问题。 在 GA 中我设置了自定义维度: 它以索引 1 显示:
我试图阻止用户与 vtkCaptionWidget 中的 anchor 进行交互 (http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/CaptionWi
我找不到使用光线追踪方法在 3D 中拾取的正确且可理解的表达方式。有人用任何语言实现过这个算法吗?分享直接工作的代码,因为由于伪代码无法编译,所以它们通常是由缺少的部分编写的。 最佳答案 您所拥有的是
我有一个相对较新的 MVC5 项目,正在使用 TeamCity 构建并由 Octopus Deploy 部署。一切都很棒,直到我通过 NuGet 添加 SQLite。当项目构建完成后,我在 bin 目
我正在尝试使用 Spring Data REST(版本 2.3.0.RELEASE)进行预测。我读了reference documentation ,并收集到这些是我需要的部分: JPA 实体 @En
我是一名优秀的程序员,十分优秀!