3.1 创建用户模型course
python ../manage.py startapp goods # 创建goods模型
3.2 在setting.py中注册goods模型(第一步)
INSTALLED_APPS = [ 'goods.apps.GoodsConfig', ] # 注:pycharm无法联想,需要把apps文件夹设置为源根
3.3 syl/urls.py添加路由(第二步)
urlpatterns = [ path('goods/', include('goods.urls')), ]
3.4 创建 goods/urls.py路由文件(第三步)
from django.urls import path, re_path from . import views urlpatterns = [ ]