如何在OSx中正确设置django项目?

时间:2023-01-13 12:31:21

I have a background in programming with python but I really would like to start playing around with django but I have had difficulty setting up a project.

我有使用python编程的背景,但我真的想开始玩django,但我很难设置一个项目。

I know that I have django installed but the command django-admin is not recognized. I believe this has something to do with the way my path is set up. I still feel clumsy about setting up correct paths, so a clear explanation of this would be greatly appreciated.

我知道我安装了django但命令django-admin无法识别。我相信这与我的道路设置方式有关。我仍然对设置正确的路径感到笨拙,所以对此的清楚解释将非常感激。

I also understand that it is advisable to set everything up within a virtual environment. I believe that I have pip installed which should enable virtualenv to be recognized, unfortunately the virtualenv command is also not recognized. I feel like I'm missing something very basic. Any help on setting up these basics would be very greatly appreciated.

我也明白,建议在虚拟环境中设置所有内容。我相信我已经安装了pip,这应该能够识别virtualenv,不幸的是virtualenv命令也无法识别。我觉得我错过了一些非常基本的东西。任何有关设置这些基础知识的帮助都将非常感激。

2 个解决方案

#1


0  

I suggest you use virtualenv - look here: Python - Virtualenv , python 3?

我建议你使用virtualenv - 看看这里:Python - Virtualenv,python 3?

Then after you source the env you simply do a pip install Django.

然后,在您获取env后,您只需执行一个pip安装Django。

#2


0  

You shouldn't do anything with paths at all, other than setting up a virtualenv. If you have pip, you can install virtualenv with sudo pip install virtualenv (and note that this is the last thing you should install with sudo pip; everything else after that should be inside an activated virtualenv).

除了设置virtualenv之外,你根本不应该对路径做任何事情。如果你有pip,你可以使用sudo pip install virtualenv安装virtualenv(并注意这是你应该用sudo pip安装的最后一件事;之后的所有其他东西都应该在激活的virtualenv中)。

#1


0  

I suggest you use virtualenv - look here: Python - Virtualenv , python 3?

我建议你使用virtualenv - 看看这里:Python - Virtualenv,python 3?

Then after you source the env you simply do a pip install Django.

然后,在您获取env后,您只需执行一个pip安装Django。

#2


0  

You shouldn't do anything with paths at all, other than setting up a virtualenv. If you have pip, you can install virtualenv with sudo pip install virtualenv (and note that this is the last thing you should install with sudo pip; everything else after that should be inside an activated virtualenv).

除了设置virtualenv之外,你根本不应该对路径做任何事情。如果你有pip,你可以使用sudo pip install virtualenv安装virtualenv(并注意这是你应该用sudo pip安装的最后一件事;之后的所有其他东西都应该在激活的virtualenv中)。