任務(wù) | 命令 |
創(chuàng)建新項(xiàng)目 | django-admin.py startproject project_name (注意: windows系統(tǒng)下請(qǐng)用django-admin startproject xxx) |
創(chuàng)建新應(yīng)用 | |
檢測(cè)模型變化,生成新的數(shù)據(jù)庫(kù)遷移文件 | |
同步數(shù)據(jù)庫(kù)與模型 | |
啟動(dòng)服務(wù)器 | python manage.py runserver |
創(chuàng)建超級(jí)用戶 | python manage.py createsuperuser |
修改用戶密碼 | python manage.py changepassword username |
打開交互終端 | |
查看當(dāng)前版本 | python manage.py version |
命令 | 用途 |
python manage.py flush | 清空數(shù)據(jù)庫(kù)內(nèi)容,只留下空表 |
python manage.py test | 開始測(cè)試 |
python manage.py collectstatic | 搜集靜態(tài)文件 |
python manage.py createcachetable | 創(chuàng)建緩存表 |
python manage.py check | 檢測(cè)項(xiàng)目有沒(méi)有問(wèn)題 |
python manage.py inspectdb [table] | 根據(jù)已有數(shù)據(jù)庫(kù)反向生成django模型。你可以選擇數(shù)據(jù)表名字 |
python manage.py makemessages | 搜集所有的messages,可以生成指定文件格式如xml文件,供后期翻譯 |
python manage.py sendemail [email] | 發(fā)送測(cè)試郵件 |
python manage.py showmigrations | 顯示所有數(shù)據(jù)庫(kù)遷移文件 |