Django專案開啟流程1
先開啟Django專案
大致流程
- 建立與進入虛擬環境
- 安裝必要套件
- 建立專案
- 在Github上面建立repository
- git初始化並上傳
下面是實際操作流程
以下是在~/PROJECT_NAME下執行
建立虛擬環境(使用python -m venv)
python -m venv project_name_venv2source venv/bin/activate./venv/bin/python -m pip install --upgrade pip
建立虛擬環境(使用conda)
conda create --name project_name_venv python3conda activate project_name_venvconda install pip
安裝必要套件與建立專案
pip install django djangorestframeworkdjango-admin startproject project_namepython3 ./manage.py startapp v1
連線到github(使用browser)
Create a github repositorycopy the ssh
連線到github(使用terminal)
go back to the project's filegit init && git add .git commit -m "first commit"git add remote sshgit branch -M maingit push -u origin main