Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

command "django-admin.py startproject mysite" not recognized

EDIT: I added the path to django-admin.py to my system path (C:UsersmeDownloadsDjango-1.5.1djangoin) but even after this when I try to run django-admin.py startproject mysite, it asks me to pick a file to open with and even when I pick python.py, it opens in chrome for some reason. I also tried python django-admin.py startproject mysite but it says

python: can't open file django-admin.py: [Errno 2] No such file or directory

Any idea what is wrong?

I added python27 to the system path and when I open up cmd and switch to a directory (C:Usersmedjcode) and then type in django-admin.py startproject mysite it says

django-admin.py is not recognized as an internal or external command, operable program or batch file

When I try typing the command python django-admin.py startproject mysite, it says

python: can't open file django-admin.py: [Errno 2] No such file or directory

Any idea why?

In the djangobook (http://www.djangobook.com/en/2.0/chapter02.html) it says

django-admin.py should be on your system path if you installed Django via its setup.py utility

what does this mean? how do I add django-admin.py to my system path? I am not sure where django-admin.py even is.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Working !!
If you are using window then first of all

create virtual environment

python -m venv venv

Then activate that environment

venvScriptsactivate

Then install Django in that environment

pip install django

Then create django project named mysite

django-admin startproject mysite

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...