Search code examples
djangomanage.py

Django App works on PyCharm by not VS-code (File manage.py line 17 error)


I have a Django App that works well in PyCharm. All modules etc work. I need, however, to open the code in Visual Studio Code. However, when I execute a:

python manage.py runserver

command in visual studio code, I get the following error:

 File "manage.py", line 17
    ) from exc
         ^
SyntaxError: invalid syntax

I've scoured the resources - but I can't find any solution. I've re-installed python Django using PIP.. - still no luck. Yes, I've reactivated the VENV - it just so happens it is stuck in activated state - but im ok with that.

Any ideas ? Thanks


Solution

  • Make sure to run with python3. Your IDE does not know what python interpreter you want to use, so always activate your environment first and check your python with python --version. Then run with:

    python3 manage.py runserver