mfussenegger / nvim-dap-python

An extension for nvim-dap, providing default configurations for python and methods to debug individual test methods or classes.
GNU General Public License v3.0
571 stars 51 forks source link

Need with with Flask and Gunicorn config #153

Closed adilJamshad closed 2 months ago

adilJamshad commented 3 months ago

This is my dap configs:

{
    "mfussenegger/nvim-dap",
    dependencies = {
      "theHamsta/nvim-dap-virtual-text",
      "rcarriga/nvim-dap-ui",
      "nvim-neotest/nvim-nio",
      "mfussenegger/nvim-dap-python",
    },
    config = function()
      local dap = require "dap"
      local dapui = require "dapui"
      require("dap.ext.vscode").load_launchjs(".vscode/launch.json", {
        python = {
          "python",
        },
      })
      -- Python Adapter Configuration
      local python_path = os.getenv "VIRTUAL_ENV"
      print(vim.inspect(python_path))
      if python_path then
        require("dap-python").setup(python_path .. "/bin/python", { include_configs = false, pythonPath = python_path })
        -- require("dap-python").configurations.python
        -- require("dap-python").adapters.python
        -- dap.adapters.python = {
        --   type = "server",
        --   command = python_path .. "/bin/python",
        --   args = { "-m", "debugpy.adapter" },
        --   port = "8080",
        -- }
      end

      -- dap.configurations.python = dap.configurations.python

      require("dapui").setup()
      vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" })

      dap.listeners.before.attach.dapui_config = function()
        dapui.open()
      end
      dap.listeners.before.launch.dapui_config = function()
        dapui.open()
      end
      dap.listeners.before.event_terminated.dapui_config = function()
        dapui.close()
      end
      dap.listeners.before.event_exited.dapui_config = function()
        dapui.close()
      end
    end,
  },

This is my .vscode/launch.json looks like:

 "configurations": [
    {
      "name": "Python: Backend",
      "type": "python",
      "request": "launch",
      "program": "${workspaceFolder}/backendvenv/bin/gunicorn",
      "args": ["--log-level=INFO","packages/backend/main.py:app" ],
      "cwd":"${workspaceFolder}",
      "port": 8080
    },
]

It fails to work for it. if it actually does, the apis return 404 path not found. My main,py is a script that initializes the server.

mfussenegger commented 2 months ago

Would need a minimal reproduction, real error messages, logs, anything...