budong
V2EX  ›  Django

有关django的urlconf的问题?

  •  
  •   budong · Aug 17, 2012 · 4201 views
    This topic created in 5042 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   ·   2932 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 12:44 · PVG 20:44 · LAX 05:44 · JFK 08:44
    ♥ Do have faith in what you're doing.