带docker的Flask调试控制台不起作用
我在 docker 中有这个烧瓶应用程序,调试模式设置为:
app_1 | * Serving Flask app 'my_app' (lazy loading)
app_1 | * Environment: development
app_1 | * Debug mode: on
app_1 | * Running on all addresses.
app_1 | WARNING: This is a development server. Do not use it in a production deployment.
app_1 | * Running on http://172.22.0.2:5000/ (Press CTRL+C to quit)
app_1 | * Restarting with stat
app_1 | * Debugger is active!
app_1 | * Debugger PIN: 140-110-975
当我遇到错误并单击小控制台图标时,系统会询问我输入的 PIN 码,然后得到:[console ready]。
但是,当我在控制台中输入内容时,我有:
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
到网址: http://localhost:5000/submit?&__debugger__=yes&cmd=dump()&frm=140300814179632&s=ljASKJ6S2EwWtVcN8EHR
我认为可能是正确的端口没有打开,因为它可能用于 websockets(在 webpack 中热重载),但在这里,端口似乎与 web 应用程序相同(5000)。
那么知道会出什么问题吗?
谢谢
我正在使用:
Python 3.9.5
Flask 2.0.1
编辑
这是docker-compose.yml:
version: "3.3"
services:
app:
build: .
command: flask run --host=0.0.0.0 --debugger
volumes:
- .:/app
working_dir: /app
ports:
- 5000:5000
env_file:
- .env