4 python django ptvs docker visual-studio-code
所以我在 Docker 中运行了这个 Django 应用程序,并且我尝试将 VS 代码附加到它,这样我就可以调试这里是我的启动文件
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 8800,
"host": "192.168.99.100",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是我的泊坞窗文件
FROM registry.gitlab.com/datadrivendiscovery/images/primitives:ubuntu-bionic-python36-v2020.1.9
ENV PYTHONUNBUFFERED 1
RUN mkdir /bbml
WORKDIR /bbml
COPY requirements.txt /bbml/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install ptvsd
ADD . /bbml/
CMD python -m ptvsd --host 0.0.0.0 --port 3500 --wait --multiprocess -m ./manage.py runserver 0.0.0.0:8800
# CMD [ "python", "./manage.py runserver 0.0.0.0:8800" ]
Run Code Online (Sandbox Code Playgroud)
这是我的 docker-compose
version: '3'
services:
web:
build: .
command: "python3 manage.py runserver 0.0.0.0:8800"
container_name: bbml
volumes:
- .:/bbml
ports:
- "8800:8800"
- "3500:3500"
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我在端口 3500 上运行 ptvsd,但每次我按下 VScode 上的绿色运行按钮时,我都会收到“connect ECONNREFUSE 192.168.99.100:3500”。有什么建议么?
归档时间: |
|
查看次数: |
10597 次 |
最近记录: |