2011-06-27 11 views
1

私は私のURLディスパッチャはDjango URLディスパッチャが機能しないのはなぜですか?

http://127.0.0.1:8000/2011/jun/26/third-entry/ 

このURLに一致していません。これは私のメインのURLディスパッチャが

urlpatterns = patterns('', 
    (r'^admin/', include(admin.site.urls)), 
    (r'^blog/', include('djangoblog.blog.urls')), 
) 

のように見え、私のブログフォルダ内に、私は別のURLを持っているものである理由として、本当に混乱していますディスパッチャ

urlpatterns = patterns('django.views.generic.date_based', 
    #regex is passed to object_detail which is the name of the generic view that will pull out a single entry 
    (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')), 
) 

私も運

でこのURLを試してみました私は本当に簡単な何かが欠けする必要があります
http://127.0.0.1:8000/blog/2011/jun/26/third-entry/ 

...

+0

"ジャンゴURLディスパッチャ" という質問ではありません。だからあなたの質問の件名を質問として編集してください。 – ThiefMaster

答えて

3

あなたの正規表現は間違っています。

(?P<year>d{4})(?P<year>\d{4})

同じURIの他の部分にも適用されるようになります。

  • (?P<day>\d{1,2})
  • (?P<slug>[-\w]+)
+2

また、そのアプリケーションからURLが送信されているので、必ずあなたのURLに '/ blog /'を含めてください! :) – jathanism

関連する問題