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 %}

  

posted on 2018-06-21 10:46  雪舞霓裳  阅读(263)  评论(0)    收藏  举报