urls.py
from django.urls import path,re_path from crm import views urlpatterns = [ re_path(r'$', views.index,name="play_index"), path('customer', views.play,name="play_list"), ]
views.py
from django.shortcuts import render # Create your views here. def index(requset): return render(requset,"index.html") def play(request): return render(request,"play/play_games.html")
index.html
{% extends "base.html" %}
{% block body %}
<ul class="nav nav-sidebar">
<li><a href="{% url 'play_index' %} ">主页</a></li> {# url'play_index' 会自动搜索urls里面定义name为play_index的路径 #}
<li><a href="{% url 'play_list' %}">游戏列表</a></li> {# url 'play_list' 会自动搜索urls里面定义name为play_list的路径 #}
</ul>
{% endblock %}
浙公网安备 33010602011771号