Django docker configration - Environment Variable Loading Issue

Cursor Bug Report: Environment Variable Loading Issue

Environment

  • OS: Windows 11
  • Cursor version: 0.39.5
  • Project structure:
    project/
    ├── .env
    └── docker/
        └── .env
    
  • webapp: postgres+django+nginx
    
    

Configuration

  • project/.env:
    ALLOWED_HOSTS=zzz.zzz.zzz.zzz
    
  • project/docker/.env:
    ALLOWED_HOSTS=localhost,127.0.0.1
    

Steps to Reproduce

  1. Navigate to the project directory: cd project/docker
  2. Run the following command:
    docker-compose down -v; docker-compose up --force-recreate
    
  3. Check webapp’s settings.ALLOWED_HOSTS
  4. Try to connect to the web app via localhost or 127.0.0.1

Results

Failure Case

Cursor’s terminal (PowerShell):

Initially worked correctly
After restarting Cursor, the following issues occurred:

  • Resulted in a 400 Bad Request error
  • When checking settings.ALLOWED_HOSTS using docker-compose exec python manage.py shell -c ..., the value was found to be “zzz.zzz.zzz.zzz” instead of “localhost,127.0.0.1”

Success Cases

After the issue repeatedly happens, I tried the same procedure with other circumstances.
The following environments successfully connected to the web site:

  • VSCode’s terminal (PowerShell)
  • PyCharm terminal (PowerShell)
  • PowerShell from Windows Start menu
  • DOS prompt from Windows Start menu

It’s so curious even other shells load project/docker/.env correctly, only cursor’s one mis-read project/.env

Attempted Solutions

  • Checked various configurations without success
  • Cleared directories related to Cursor settings
  • Reinstalled Cursor (0.39.6), which resolved the issue

Questions

  1. Why did this issue occur specifically in Cursor’s terminal?
  2. What is the simplest way to fix this issue without reinstalling Cursor?
  3. Are there any known issues with environment variable loading in Cursor?

Additional Notes

The problem seems to be related to how Cursor’s terminal reads or interprets environment variables, specifically when using Docker Compose.

Any insights or suggestions for further investigation would be appreciated.