开发者

Django URL matching

开发者 https://www.devze.com 2022-12-30 08:16 出处:网络
Can anyon开发者_JS百科e see why this wouldn\'t be working? I\'m fairly new to Django so any help would be much appreciated.

Can anyon开发者_JS百科e see why this wouldn't be working? I'm fairly new to Django so any help would be much appreciated.

Actual URL: http://127.0.0.1:8000/2010/may/12/my-second-blog-post/

urls.py:

(r'(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',template_name='blog/detail.html')),


r'(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[\w-]+)/$', 
'object_detail', 
dict(info_dict, slug_field='slug',template_name='blog/detail.html')),

You seem to have forgotten the backslashes.


Are you specifying this in an app context or in the project url routing?

You may need to start your regular expression with a ^.

(r'^foo/$', 'foo'),
0

精彩评论

暂无评论...
验证码 换一张
取 消