
from django.conf.urls import url

from App import views

"""
1 匹配规则一般用原生字符串书写
2 匹配规则不要用/开头
3 一般情况下，匹配规则应该以^开始,以$结束，表示完整匹配整个字符串
4 匹配规则最后应该以/结尾
5 从上往下匹配，一旦匹配成功立即结束
"""

urlpatterns = [
    url(r'^$',views.home,name='home'),
    # url(r"^/index/$",views.index,name='index'),
    #能匹配以index/为结尾任何字符串
    # http://127.0.0.1:9000/app/djj/ddddsf/d/index/
    # url(r"index/$",views.index,name='index'),
    #匹配包含index/任何字符串
    # url(r"index/",views.index,name='index'),
    # url(r"list/index/",views.list_index,name='index'), #这个路由不会匹配到
    #
    #index/
    url(r'^index/$',views.index,name='index'),

    #动态路由
    #show/tom/20/
    #show函数中位置参数个数应该是匹配规则中（）个数加1
    # url(r'^show/(\w+)/(\d+)/$',views.show,name='shwo'),

    #命名组
    url(r'^show/(?P<name>\w+)/(?P<age>\d+)/$',views.show2,name='shwo'),
    #不能混用命名组和无命名组
    # url(r'^show/(?P<name>\w+)/(\d+)/$',views.show2,name='shwo'),

    url(r'^index1/$',views.bbs_index,name='bbs_index'),
    url(r'^index1/(\d+)/$',views.bbs_index,name='bbs_index2'),
]
