Because the URL patterns are regular expressions, there really is no limit on what you can do with them. And there’s no need to add URL cruft such as .html – unless you want to, in which case you can do something like this:
url(r'^polls/latest\.html$', views.index),
But, don’t do that. It’s silly.
path只是個字符串
他可以映射到服務器的一個文件名 (.php, .asp)
在framework或rewrite的支持下也可以不映射
django的教程有這麼一段:
能想到的有两种情况,一是help只是个文件夹,在他下面有默认文件名的index.php或者index.html.二是网站设置了路由规则,也就是这个url会被网站重新解析到指定路径
在j2ee的web框架spring mvc或者struts中,这个应该是url映射,比如你上面的help映射成框架里的控制器,然后控制器处理完相应业务逻辑之后跳转到指定页面显示处理结果。
现在的网站基本是动态的,URL不不代表网站的真实目录,因为已经rewrite,也就是服务器可以控制要不要加,也可以完全重写URL,不加可以提高安全性,虽然这个安全性现在看来没什么鸟用。
因为路由,给一个url(有没有后缀名都行),服务器会根据url返回相应的页面.jsp,.php,.html等。