【发布时间】:2020-06-08 11:56:32
【问题描述】:
我正在使用 django 3.0 和 python 3.8。我是编码新手。下面是我的项目层次结构。我想通过单击下面的 html 代码的继续按钮将我的“主页”页面连接到下一个 html“teoco”页面
myproject.urls-
from django.contrib import admin
from django.urls import path,include
urlpatterns = [
path('', include('training_review.urls')),
path('teoco', include('training_review.urls')),
path('admin/', admin.site.urls),
]
home.urls-
from django.urls import path
from . import views
urlpatterns = [
path('',views.home, name='home'),
path('teoco',views.teoco, name='teoco')
]
home.views-
def home(request):
return render(request, 'home.html')
def teoco(request):
return render(request, 'teoco.html')
【问题讨论】:
-
可以直接在href中使用
{% url 'teoco' %}
标签: python django python-3.x django-views django-templates