'django-admin startproject myproject' is not recognised

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. At line:1 char:1

  • django-admin startproject myproject
  •   + CategoryInfo          : ObjectNotFound: (django-admin:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

i tried running this django-admin startproject myproject

If you install Django, then you install a small executable django-admin to help with some administrative tasks.

But the shell needs to be able to find that executable, so the $PATH variable needs to include the directory where Python keeps these executables. For a Windows system, that is typically at ~\AppData\Roaming\Python3n\Scripts (the tilde is something that resolves to the user directory, and equivalent to %userprofile% on PowerShell). You thus should add this path to the $PATH variable.

But it is not really necessary, django-admin is not much more than python -m django, so you can rewrite django-admin startproject myproject to:

python -m django startproject myproject
Вернуться на верх