简体   繁体   English

django-admin 打开新项目

[英]django-admin to open a new project

I am using this command:我正在使用这个命令:

django-admin startproject Hello

to initiate a new project, but I am getting the following error启动一个新项目,但我收到以下错误

django-admin : The term 'django-admin' is not recognized as the name 
of a cmdlet, function, script file, or operable program. Check the   
spelling of the name, or if a path was included, verify that the     
path is correct and try again.
At line:1 char:1
+ django-admin startproject Hello
+ ~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (django-admin:String)  
   [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

just started with django and this is so frustrating刚从 django 开始,这太令人沮丧了

It seems that you dont have django installed.您似乎没有安装 django。 If you have already installed it, you should check if you are with your virtual enviroment (venv) activated.如果您已经安装了它,您应该检查您的虚拟环境 (venv) 是否已激活。 Check this doc: https://docs.python.org/pt-br/3/library/venv.html检查此文档: https://docs.python.org/pt-br/3/library/venv.html

Go to the project directory and try this: Go 到项目目录并试试这个:

python3 -m venv venv
source venv/bin/activate

Then:然后:

django-admin --version **(to check if it is installed)**
django-admin startproject Hello

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM