Changing env from Django 2.2 to 4.0.1

Hello

I am going through the Polls-tutorial.
I have Django 4.0.1 installed and Python 3.9 on my Windows computer.

For some reason i have messed this up and the Django i am using is 2.2.
I am using VSCode to go through the tutorial.
I want to switch to 4.0.1 so i, in particular, can use @admin.display.

Thanks for any help

Can you provide more specific details about how you installed Python and Django on your computer?

Do you have them set up as a system wide, or as a user-based installation? Are you using a Python virtual environment (venv) or a global instance?

Leave VSCode aside for the moment; are you having the same issues if you try to start this using the command line?

(Part of the diagnostic process here is figuring out if the issue is with the installation or with your VSCode configuration.)

“Can you provide more specific details about how you installed Python and Django on your computer?”

  • I installed Python via the python.org and it is version 3.9
    Django i installed via cmd-line with pip install django.
    Then i verified the Django-install with *python -m django --version * that returns version 4.01.

“Do you have them set up as a system wide, or as a user-based installation?”

  • The installation is for “all users”

“Are you using a Python virtual environment (venv) or a global instance?”

  • Not entirely sure what this means, i am using a venv in VSCode

“Leave VSCode aside for the moment; are you having the same issues if you try to start this using the command line?”

  • Yes, cannot start it from the cmd line

This is from my current VSCode-project for the Polls-tutorial

How did you create the venv? Clearly, it’s showing a different version of Django than what you reported earlier.

Please elaborate:

  • Identify what your current directory is
  • Show the complete commands you are entering
  • Report the specific and complete error messages being returned.
  • Also show the output from:
    • python -V
    • pip list

“How did you create the venv? Clearly, it’s showing a different version of Django than what you reported earlier.”

In VSCode - it does it automatically when i use the Python Django - debugger

“Please elaborate”
Identifying my current directory and the complete command i am entering

C:\Users\tesve\source\repos\LearningDjango\LearningDjango>py manage.py runserver
The system cannot find the path specified.

I edited the code since i misunderstood your question

python -V
returns Python 3.9 .10

pip list
image

What is this command py that you’re trying to run? Is that a cmd file you’ve built?