budong
V2EX  ›  Django

有关django的urlconf的问题?

  •  
  •   budong · Aug 17, 2012 · 4142 views
    This topic created in 5021 days ago, the information mentioned may be changed or developed.
    有人可以解释下吗:
    # urls.py

    from django.conf.urls.defaults import *
    from mysite import views

    urlpatterns = patterns('',
    (r'^blog/$', views.page),
    (r'^blog/page(?P<num>\d+)/$', views.page),
    )

    # views.py

    def page(request, num='1'):
    # Output the appropriate page of blog entries, according to num.
    # ...

    那个urlconf中page(?P<num>\d+)这个page是否多余,如果不多余该怎么理解?
    文章原文地址: http://djangobook.py3k.cn/2.0/chapter08/
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1024 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:04 · PVG 07:04 · LAX 16:04 · JFK 19:04
    ♥ Do have faith in what you're doing.