一、路由系统,URL

  1. url(r'^index',views.index) #默认的                  url(r'^home',views.Home.as_view()) # CBV 形式 也就是说 class

  2.url(r'^detail-(\d+).html', views.detail),       # 在views里 def  home(request, nid, uid) 这两个参数不能调换循序    #http://www.baidu.com/detail-2-8.html   2是nid   8是uid

  3.url(r'^detail-(?P<nid>\d+)-(?P<uid>\d+).html', views.detail)   #多个正则  在views里 def  home(request, nid, uid) 这两个参数可以没有顺序

    PS :

      url(r'^detail-(\d+).html', views.detail),

      def    detail(request, *args, **kwargs)   这种方式可以替换   def    detail(request,nid,uid)

    实战:

     a.

      url(r'^detail-(\d+)-(\d+).html', views.detail),

      def func(request, nid, uid):

      def func(reuqest, *args):

      def func(request, *args, **kwargs)

     b.

      url(r'^detail-(?P<nid>\d+)-(?P<uid>\d+).html', views.detail)

      def func(request, nid, uid):

      def func(request, **kwargs): #或者 *args **kwargs 这样的话就有一个没有值的

        kwargs= {'nid':1, 'uid':3}

最新文章

  1. Kafka Linux 安装
  2. 教你轻松计算AOE网关键路径(转)
  3. VC++中StretchBlt图像失真问题的解决办法
  4. asp.net程序员初涉node.js
  5. 一、Docker之旅
  6. PRISM ‘VS100COMNTOOLS’ not set. Cannot set the build environment
  7. Linux基本配置
  8. 自定义绘制View
  9. 检测鼠标键盘多久没有活动(使用GetLastInputInfo API函数检测)
  10. MVC Controller 与 View 传值
  11. Nginx中location配置[转]
  12. HTTP 响应
  13. MYSQL高可用(HA)随想
  14. docke镜像上传到dockerhub仓库和阿里云docker仓库的方法
  15. 【Android 应用开发】Android UI 设计之 TextView EditText 组件属性方法最详细解析
  16. ElasticSeaarch 遇到的问题 (-)
  17. python学习笔记(三)- 字典、集合
  18. HDU 4348 To the moon(主席树区间修改)
  19. 【题解】【THUSC 2016】成绩单 LOJ 2292 区间dp
  20. 远程桌面能连接到服务器,但PING不通

热门文章

  1. Elasticsearch入门CRUD(新增、查询、修改、删除)
  2. iphone 自学常用网址
  3. oracle创建表空间、用户、权限
  4. clang命令理解程序
  5. 禅道与bugfree区别
  6. JAVA编程思想第一章——对象导论
  7. html个人简历
  8. 【Ubuntu】执行定时任务(cron)
  9. RealVNC
  10. Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. 调用函数约定不同