django の URL の一部が機能しません。インデックス ページと django 管理ページに問題なくアクセスできます。問題なくログインしてオブジェクトを作成できます。たとえば、以下のようなサイトを作成できますが、サイトのコレクションにアクセスしようとすると、(作成した後でも) 404 が表示されます。私も Django allauth を使用していますが、これらのページでも urlconf に問題があります。誰でもエラーを見つけることができますか?
たとえば、次の URL です。
Page not found (404)
Request Method: GET
Request URL: http://myapp.com/admin/sites/site/
No reward found matching the query
そしてこれ:
Page not found (404)
Request Method: GET
Request URL: http://shielded-island-1440.herokuapp.com/accounts/profile/
Using the URLconf defined in litherewards.urls, Django tried these URL patterns, in this order:
^ ^$ [name='index']
....
^ ^reward/$ [name='reward_list']
^ ^redeem/(?P<reward_code>)/$ [name='redeem_reward']
^ ^redeem/(?P<slug>\w+)/(?P<reward_code>\w+)/$ [name='reward_confirmation']
....
^account/
^sitemap\.xml$
^admin/
私のurlconfは次のとおりです。
from django.conf.urls import patterns, include, url
from myapp.views import RewardSitemap
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
sitemaps = {'rewards':RewardSitemap}
urlpatterns = patterns('',
url('^', include('myapp.urls', namespace="fluffy")),
url(r'^account/', include('allauth.urls')),
url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
url(r'^admin/', include(admin.site.urls)),
)
最初の urlconf に含まれる myapp の URL:
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name="index"),
....
url(r'^reward/$', RewardsList.as_view(), name="reward_list"),
url(r'^redeem/(?P<reward_code>)/$', RedeemReward.as_view(), name="redeem_reward"),
url(r'^redeem/(?P<slug>\w+)/(?P<reward_code>\w+)/$', RedeemConfirmation.as_view(), name="reward_confirmation"),
)
最後に、 myROOT_URLCONF
は に設定されmyapp.urls
ます。インデックスページは問題なく動作します。