文章目录 打开一个终端输入新建app命令在app下的views.py内写一个视图app路由引入该视图项目路由引入app路由项目(settings.py)引入app(AntappConfig配置类)运行项目 打开一个终端 输入新建app命令 python manage.py startapp antapp 在app下的views.py内写一个视图 from django.http import HttpResponse# Create your views here. def hello(request):return HttpResponse("this is hello/") app路由引入该视图 from django.contrib import admin from django.urls import path from antapp import viewsurlpatterns = [path("hello/", views.hello), ] 项目路由引入app路由 from django.contrib import admin from django.urls import path,includeurlpatterns = [path("admin/", admin.site.urls),path("", include("antapp.urls")), ] 项目(settings.py)引入app(AntappConfig配置类) "antapp.apps.AntappConfig", 运行项目