Paul Noon
Paul Noon

Reputation: 686

Django does not detect change to the code when running it with Cursor

My app is based on Django 4.2.16.

When I run the app in PyCharm, I see the following message when I run the app:

"Watching for file changes with StatReloader".

In this setup, changes to HTML files are immediately reflected on the web page after refreshing the browser. The application automatically reloads when I make changes to backend code. However, after switching to Cursor, this behavior is no longer working:

I need to manually stop and restart the server for changes (both to HTML and backend code) to take effect. Here is my launch.json configuration in Cursor:

{
  "version": "0.2.0",
  "configurations": [
      {
          "name": "Django",
          "type": "python",
          "request": "launch",
          "program": "${workspaceFolder}/manage.py",
          "args": ["runserver", "localhost:8000"],
          "django": true,
          "justMyCode": true,
          "console": "integratedTerminal",
          "cwd": "${workspaceFolder}",
          "pythonPath": "C:/Users/xxx/miniconda3/envs/xxxconda3/python.exe"
      }
  ]
}

Here is the launch command :

PS C:\app\xxx>  C:; cd 'C:\app\xxx'; & 'C:/Users/xxx/miniconda3/envs/xxxconda3/python.exe' 'c:\Users\xxxx\.cursor\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '54125' '--' 'C:\app\xxx/manage.py' 'runserver' 'localhost:8000' 

I tried to install watchdog with pip but it did not change anything.

In my settings.py file, DEBUG = True

What can I do ?

Upvotes: 0

Views: 30

Answers (0)

Related Questions