[Answer]-How to start a new django project from any directory

1👍

Not a windows guy, but try running the command from the directory where you want your site to live.


cd C:\Sites
python django-admin.py startproject mysite

If that doesn’t work, then is that you don’t have Django in your PATH. Add Django to your PATH. Otherwise you’ll have to do

python C:\path\to\django-admin.py startproject mysite

Also check out https://docs.djangoproject.com/en/dev/intro/install/ for more documentation on setting up your Django environment.
Hope that helps!

0👍

You could create a .cmd file that contains

python c:\python27\scripts\django-admin.py %1 %2 %3 %4 %5

name it django-admin.cmd and put it in c:\windows\system32

Then you should be able to

django-admin startproject mysite anywhere

0👍

it seems like the problem is the .py files’s default open way.
first, find a .py file.
right click on it,and select “open with” , here u should use python as your default open mode

then restart your cmd, it should be worked.

here is another same problem Can't open file 'django-admin.py': [Errno 2] No such file or directory

0👍

You can use virtualenv‘s. After creating an env, installing django, and activating and env django-admin commands should become available. A recent similar question.

Leave a comment