cmd命令行,粘貼執行以下代碼:
pip install virtualenv
mkdir mysite1
cd mysite1
virtualenv .venv
.venv\Scripts\activate.bat
pip install django==3.2
django-admin startproject mysite1 .
django-admin startapp app01
命令解析:
安裝virtualenv模塊:pip install virtualenv
創建一個項目文件夾:mkdir mysite1
切換到項目文件夾:cd mysite1
創建一個虛擬環境:virtualenv .venv
啟動這個虛擬環境:.venv\Scripts\activate.bat
安裝django指定版本:pip install django==3.2
創建一個django項目:django-admin startproject mysite1 .
創建一個app應用:django-admin startapp app01
具體步驟:
C:\Users\sheng>pip install virtualenv
C:\Users\sheng>mkdir mysite1
C:\Users\sheng>cd mysite1
C:\Users\sheng\mysite1>virtualenv .venv
C:\Users\sheng>.venv\Scripts\activate.bat
C:\Users\sheng>.venv\Scripts\activate
(.venv) C:\Users\sheng>pip install django==3.2
(.venv) C:\Users\sheng>django-admin startproject mysite1 .
(.venv) C:\Users\sheng>django-admin startapp app01
執行結果:
Preface Click It is a simple a
Catalog 1. When and how to use