firefox-devtools / firefox-devtools/vscode-firefox-debug

Path mappings not working with Python/Django project

Abierto
#241 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
TypeScript
Estrellas
447
Forks
76
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

regards to: Debugger for FireFox v2.9.1

With Python/Django a URL maps to a path in an "app" folder. The HTML code is generated by Jinja2 template engine. I included a JS file into a Jinja2 template file:

{% block javascript %}
<script src="{{ static('assets\plugins\custom\leaflet\leaflet.bundle.js') }}"></script>
<script type="text/javascript">
{% include "map/js/map.js" %}
</script>
{% endblock javascript %}

The static JS files assets\plugins\custom\leaflet\leaflet.bundle.js is found by "vscode-firefox-debug", but the included JS file map/js/map.js is not.
The path structure is as followed:

${workspaceFolder}
|-- www
|    |-- jinja
|          |-- map
|               |-- js
|                    |-- map.js
|-- static
     |-- assets
           |-- plugins
                |-- custom
                     |-- leaflet
                          |-- leaflet.bundle.js

The URL http://127.0.0.1:8000/map is mapped in the Django project to the path ${workspaceFolder}\\www\\jinja\\map and is working (shows the website).

The problem is, that the mapping with ${workspaceFolder}\\.vscode\\launch.json is not working. My configuration is as followed:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}\\manage.py",
            "args": [
                "runserver",
                "--noreload"
            ],
            "django": true
        },
        {
            "name": "JS",
            "type": "firefox",
            "firefoxExecutable": "D:\\Tools\\FirefoxPortable\\FirefoxPortable.exe",
            "request": "launch",
            "reAttach": true,
            "url": "http://127.0.0.1:8000/",
            "webRoot": "${workspaceFolder}",
            "pathMappings": [
                {
                    "url": "http://127.0.0.1:8000/map/(index)",
                    "path": "${workspaceFolder}\\www\\jinja\\map\\js\\map.js"
                },
            ],
            "skipFiles": [
                "${workspaceFolder}\\static\\**\\*.js"
            ],
            "log": {
                "consoleLevel": {
                    "PathConversion": "Debug",
                    "default": "Error"
                }
            }
        }
    ]
}

I also tried different paths, e.g. ${workspaceFolder}\\www\\jinja\\map\\js or ${workspaceFolder}\\www\\jinja\\map, and even ${workspaceFolder}\\www\\jinja\\map\\js\\index.html with a dummy HTML file as workaround, which includes only the JS file. But in the status window for the debugger appears not the correct mapping, but ${workspaceFolder}\\map (as the URL)

Output from Debug Console:

DEBUG|000.121|PathConversion: Converted url http://127.0.0.1:8000/static/assets/js/scripts.bundle.js to path ${workspaceFolder}\static\assets\js\scripts.bundle.js
DEBUG|000.122|PathConversion: Converted url http://127.0.0.1:8000/map/ to path ${workspaceFolder}\map\
DEBUG|000.123|PathConversion: Converted url http://127.0.0.1:8000/static/assets/plugins/custom/leaflet/leaflet.bundle.js to path ${workspaceFolder}\static\assets\plugins\custom\leaflet\leaflet.bundle.js
DEBUG|000.124|PathConversion: Converted url http://127.0.0.1:8000/static/assets/plugins/global/plugins.bundle.js to path ${workspaceFolder}\static\assets\plugins\global\plugins.bundle.js

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con las entradas pathMappings y webRoot de .vscode/launch.json y compáralas después con la salida de PathConversion de Debug Console para /map/ y los archivos estáticos. Reproduce la página de Django/Jinja2 y verifica que el www/jinja/map/js/map.js incluido se resuelva en la ruta local indicada, mientras las asignaciones estáticas existentes siguen funcionando.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
django, python, vscode
Área
devtools
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.