Search code examples
pythondjangopowershell

Using django-admin on windows powershell


In the Django tutorial for starting a new project, the command to run is

django-admin.py startproject mysite

However, when I run this, I always encounter the following error:

django-admin : The term 'django-admin' is not recognized as the name of a cmdlet, 
function, script file, or operable
program. Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.

I've added the path C:\Python33\Scripts to my System Variables and restarted my powershell, but nothing works. I've figured out that the workaround is to instead execute the following:

py C:\Python33\Scripts\django-admin.py startproject mysite

Is there any way to fix this problem to where I just need to call django-admin.py instead of specifying the directory?

Clarification: This error is with Windows Powershell. Windows Command Prompt works fine but I was wondering what was causing this difference


Solution

  • in CMD (Command) or Powershell run this code, it works fine:

    • validation
    python -m django --help
    
    • start a new project
    python -m django startproject mysite