文章目录
打开一个终端

输入新建app命令
python
python manage.py startapp antapp

在app下的views.py内写一个视图
python
from django.http import HttpResponse
# Create your views here.
def hello(request):
return HttpResponse("this is hello/")

app路由引入该视图
python
from django.contrib import admin
from django.urls import path
from antapp import views
urlpatterns = [
path("hello/", views.hello),
]

项目路由引入app路由
python
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path("admin/", admin.site.urls),
path("", include("antapp.urls")),
]

项目(settings.py)引入app(AntappConfig配置类)
python
"antapp.apps.AntappConfig",

运行项目
