1

This happened to me on multiple machines already... typing django-admin.py startproject test yields the The term 'django-admin.py' is not recognized as the name of a cmdlet.... error, while trying to call on any other module or script in the python Scripts folder works...

Typing python [Scripts path]\django-admin.py startproject test works perfectly, so does copying django-admin.py to my working directory... it just won't call it straight up.

I've been googling for a while and it seems like this problem is always people not having Scripts added in their PATH. I did, however. Is there something else I am missing? Much appreciated.

dedalus_rex
  • 459
  • 1
  • 7
  • 16

3 Answers3

0

Have you created the association so what Windows knows that .py extension files are supposed to be run with the Python application?

Script to associate an extension to a program

Community
  • 1
  • 1
mjolinor
  • 66,130
  • 7
  • 114
  • 135
  • Yes I've encountered another open question that address this issue. Although this seems to be pertinent after the shell finds the `.py` file. I can't find the post right now but in the question the poster reports seeing the windows prompt being open of which program to use for the `.py` file – dedalus_rex Dec 31 '13 at 21:19
0

Seems to be related to django not being in your PATH variable properly. I'll play around with it more later, but in the mean time a quick fix is just to call it directly:

C:\Python27\Scripts\django-admin.py startproject YourProjectName

(this will be different with Python3 obviously).

Worked for me, and so I hope it helps.

Paolo
  • 410
  • 3
  • 12
-1

In Windows where you can edit PATH, under this you have PATHEXT. At the end, add .PY so PowerShell will know that .py files are executable.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
  • Specifically, add `;.PY` to the end of PATHEXT in the lower half of the dialog found under the Environment button in the Advanced tab of System Properties, reachable with Win+Break. – Nathan Tuggy Dec 30 '14 at 00:32