I'm following a tutorial on Django and I'm suppose to create a folder via Windows Command Prompt (the turorial asks to type the following at C:\
):
我正在關注Django的教程,我想通過Windows命令提示符創建一個文件夾(turorial要求在C:\中鍵入以下內容):
django-admin.py startproject django_bookmarks
and I should get the following folder with these files:
我應該使用這些文件獲取以下文件夾:
django_bookmarks/
__init__.py manage.py settings.py urls.py
I tried at c:\, at c:\Django-1.4.2.
我試着在c:\,在c:\ Django-1.4.2。
and I get the same following error messages:
我得到以下錯誤消息:
"Django-1.4.2 is not recognized as an internal or external command, operable program or batch file"
“Django-1.4.2不被識別為內部或外部命令,可操作程序或批處理文件”
Note: Django is properly installed. I made a test on python and it shows Django's version properly.
注意:Django已正確安裝。我在python上做了一個測試,它正確顯示了Django的版本。
How do I create that folder?
如何創建該文件夾?
Any help will be appreciated.
任何幫助將不勝感激。
6
You may try using the following command (if Python-2.7.X is your interpreter, and if you have not installed Django in a virtualenv):
您可以嘗試使用以下命令(如果Python-2.7.X是您的解釋器,如果您沒有在virtualenv中安裝Django):
C:\Python27\Scripts\django-admin.py startproject django_bookmarks
C:\ Python27 \ Scripts \ django-admin.py startproject django_bookmarks
If you have installed Django in a virtualenv, replace the part C:\Python27
by the path to this virtualenv.
如果您已經在virtualenv中安裝了Django,請將此部分C:\ Python27替換為此virtualenv的路徑。
If you have installed several versions of Python, Have a look at this SO answer
如果您已經安裝了多個版本的Python,請查看此SO答案
4
$
is not a part of the command, it is a command prompt. It indicates that the command should be entered in a command line interpreter.
$不是命令的一部分,它是一個命令提示符。它表示應該在命令行解釋器中輸入命令。
The command itself should start with django-admin.py
:
命令本身應該以django-admin.py開頭:
django-admin.py startproject django_bookmarks
0
In case if someone still needs, you have to have python in front of that:
如果有人仍然需要,你必須在前面有python:
directory1\directory2>python django-admin.py startproject django_bookmarks.
0
Use this command after activating your virtual environment.
激活虛擬環境后使用此命令。
django-admin startproject project_name
then to create a new app run this command:
然后創建一個新的應用程序運行此命令:
python manage.py startapp app_name
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2013/01/30/725eb75dd259d430d257d8e5495672b7.html。