Django--django-admin.py does not work on windows

I am just starting Django these days, but I cannot run this command

django-admin.py startproject myproject 

Well, CMD does not suggest that this command is not recognized. Instead, it simply opens my Sublime with the opening of the django-admin.py file. and of course, the folder named myproject is not created in the current folder.

I managed to start a Django project by typing commands like

  python C:\Python27\Scripts\django-admin.py startproject myproject 

But when I omit the part about the absolute information about the django-admin.py path, the command does not work, saying that python cannot find such a file inside the current directory.

Can shorter commands be used? (PS: I have C: \ Python27 \ and C: \ Python27 \ Scripts \ in PATH)

+6
source share
4 answers

The easiest way ( recommended by the docs ) is to simply copy django-admin.py to the project directory.

Technical details: In setuptools there is a way to bypass Windows entry points by installing a .exe file that will work correctly even if Python is not installed as the default handler for .py files, but Django does not use setuptools , but distutils directly. I am not aware of any discussions about switching to setuptools.

Alternatively, you can set python.exe as the default program to open .py files instead of a text editor.

+7
source

In the past, I had a similar problem with windows. I found that using django-admin as below works.

 django-admin.py startproject myproject 
+1
source

I found that it was easy to copy the django-admin.py file to the folder in which I wanted to get the material. Browse to the file on the command line and then run.

 'python django-admin.py startproject myProject' 
0
source

I just started using python3.4, and I found everything (packages like pip and django) in the c: \ pythonpath \ scirpts directory. This is added to the system path, and everything works well. e.g. django-admin startproject mysite

0
source

Source: https://habr.com/ru/post/956726/


All Articles