建立專案store
#django-admin startproject store
新增應用程式shop
#cd store
#python manage.py startapp shop
Step1)編輯store\settings.py,在INSTALLED_APPS內新增應用程式shop,TEMPLATES的DIRS新增templates
Step2)編輯store\urls.py
Step3)編輯shop\models.py
編輯shop\admin.py
Step4)編輯shop\views.py
Step5)編輯shop\urls.py。
Step6)編輯templates\base.html
編輯shop\templates\list.html
編輯shop\templates\shop_detail.html
Step7)安裝其他套件與設定
pip install Pillow
pip install django-bootstrap3
編輯store\settings.py,在INSTALLED_APPS內新增應用程式bootstrap3
Step8)建立資料庫與管理者帳號
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
Step9)瀏覽http://127.0.0.1:8000/admin使用管理者帳號登入,新增商品類別與商品
Step10)點選「全部商品」,列出所有商品