Django: When creating a new project, “django-admin.py: command not found” Error pops up

浪尽此生 提交于 2020-01-05 07:18:39

问题


I've been following the tutorial on the django website and have been running into a problem regarding setting up Django: https://docs.djangoproject.com/en/dev/intro/tutorial01/

I've installed Django through their guide using setup.py, but when I run "django-admin.py startproject mysite" on the terminal, it outputs the error "-bash: django-admin.py: command not found". I've tried django-admin as per some google searches and some searches have told me to try the following commands

cd /usr/local/bin
ln -s /usr/local/django/trunk/django/bin/django-admin.py django-admin.py

but I continue to get "ln: django-admin.py: Permission denied" in that case.

I use the macports Python and was wondering if I could get any help regarding the matter. Thank you very much in advance!

SOLUTION: Thanks Doug!

After some googling I found: https://code.djangoproject.com/wiki/InstallationPitfalls which told me a similar solution. I needed to link to my bin and give permissions. Also the command needed to be run with django-admin2.6.py otherwise would not work.


回答1:


Try: export PATH=$PATH:/usr/local/django/trunk/django/bin




回答2:


For solving the 'Permission Denied' error:

chmod +x path/to/bin/django-admin.py

Running the above in Terminal (edited to your own file) solved my own 'Permission Denied' error while setting up Django in a virtualenv on a Webfaction server.



来源:https://stackoverflow.com/questions/6590521/django-when-creating-a-new-project-django-admin-py-command-not-found-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!