URL参数传递的情况

 

from django.conf.urls import patterns, include, url


urlpatterns = patterns('blog.views',
   
   url(r'^blog/index/(?P<id>\d{2})/$','index'),

)

 

from django.shortcuts import render_to_response


def index(req,id):
 
    return render_to_response('index.html',{'title':'My page','id':id})

 

 

<!DOCTYPE html>
<html>
<head>

    <title>{{ title }}</title>

</head>

id : {{ id }}

<body>

</html>

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(django)