4

エラー:

Request Method: GET
Request URL:    http://192.168.100.10/accounts/profile/
Using the URLconf defined in urls, Django tried these URL patterns, in this order:
^collect/
^member/
^accounts/login/$
^ ^$
^ ^contact/$
^ ^privacy-statement/$
^logout/$ [name='logout']
^data-admin/doc/
^accounts/password/reset/$
^accounts/password/reset/done/$
^accounts/password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$
^accounts/password/done/$
^media/(?P<path>.*)$
The current URL, accounts/profile/, didn't match any of these.

このエラーはログイン後に発生し、ユーザー名とパスワードを受け入れており、/index/ ページに正常にアクセスする必要がありますが、accounts/profile/ にアクセスしています。accounts/profile/ を削除して IP を実行すると、リダイレクトされます。正しい URL。

アプリのurls.py

from django.conf.urls.defaults import *

urlpatterns = patterns(
    'zergit.views',
    (r'^$', 'index'),
  )

ありがとう

4

2 に答える 2

12

LOGIN_REDIRECT_URLデフォルト設定を変更する必要があります

デフォルトでLOGIN_REDIRECT_URLは、 に設定されてい/accounts/profile/ます。URL に が含まれていないことは明らか/accounts/profile/なので、ログインが成功したらリダイレクト先の URL を指定する必要があります。

何かのようなもの:

LOGIN_REDIRECT_URL = '/' #Or whatever you wish
于 2013-07-01T15:20:53.387 に答える
0

LOGIN_REDIRECT_URL 設定を変更したくない場合は、アカウントのログイン URL に「next」パラメータと値を使用して、必要な場所にリダイレクトしてください。たとえば、OP は要求されたログイン URL を「http://192.168.100.10/accounts/login/?next=/index/」として指定できます。

于 2015-11-06T08:58:43.547 に答える