项目名:chapter01
应用名:hello
第一步
将应用名激活:在项目settings.py的INSTALLED_APPS 中加入应用名hello
第二步
配置根路由:在项目 urls.py中配置path('hello/',include('hello.urls')),
第三步
配置相关的子路由:在应用 urls.py中配置path('',views.index)
第四步
编写视图: 在应用 views.py中加入index()函数
def index(request):
return http.HttpResponse('hello word!')
第五步
在cmd中运行代码python manage.py runserver,并在网页上输入http://127.0.0.1:8000/hello/
感谢观看,希望对你有用!!!



