I am just starting Django these days but I cannot run this command
django-admin.py startproject myproject
Well, CMD does not prompt to say that this command is not recognized. Instead, it just open up my Sublime with the file django-admin.py open. and of course no folder named myproject is created inside 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 path information of django-admin.py, then the command does not work, saying python cannot find such a file inside the current directory.
is there any way I should try to use shorter commands? (PS: I do have C:\Python27\ and C:\Python27\Scripts\ in the PATH)
The easiest way (recommended by the docs) is to just copy django-admin.py to your project's directory.
Technical details: There are workaround in setuptools
to make entry points work correctly on Windows, by installing a .exe file that will run correctly even if Python is not set as the default handler for .py files, but Django is not using setuptools
but distutils
directly. I am not aware of any discussion about moving to setuptools.
Alternatively you can set python.exe as the default program to open .py files, instead of your text editor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With