61

と入力すると、この問題が発生しlocalhost:8000/admin/ます。

`TemplateSyntaxError: 残りを解析できませんでした: 「admin:password_change」からの「:password_change」。Django 1.5 で「url」の構文が変更されました。ドキュメントを参照してください。

これが私の一部ですsettings.py

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'grappelli',
    'filebrowser',
    # Uncomment the next line to enable the admin:
     'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    #'django.contrib.admindocs',
     'tinymce',
     'sorl.thumbnail',
     'south',
     'django_facebook',
     'djcelery',
     'devserver',
     'main',
)
AUTH_USER_MODEL = 'django_facebook.FacebookCustomUser'

AUTHENTICATION_BACKENDS = (
    'django_facebook.auth_backends.FacebookBackend', 
    'django.contrib.auth.backends.ModelBackend',
    # Uncomment the following to make Django tests pass:
    'django.contrib.auth.backends.ModelBackend',
)

私は何か悪いことをしましたか?

PS: これは私の完全なトレースバックです https://gist.github.com/anonymous/e8c1359d384df7a6b405

編集:

リクエストごとにgrepの出力を貼り付けています:

$ ack-grep --type=python -r ':password_change' .
lib/python2.7/site-packages/django/contrib/admin/sites.py
264:url = reverse('admin:password_change_done', current_app=self.name)

lib/python2.7/site-packages/grappelli/dashboard/dashboards.py
147:reverse('%s:password_change' % site_name)],

$ ack-grep --type=html -r ':password_change' .
lib/python2.7/site-packages/django/contrib/admin/templates/admin/base.html
36:<a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a> /

lib/python2.7/site-packages/grappelli/templates/admin/includes_grappelli/header.html
12:{% url admin:password_change as password_change_url %} 
4

8 に答える 8

2

私にとっては、{% %} の代わりに {{ }} を使用していました。

href="{{ static 'bootstrap.min.css' }}"  # wrong
href="{% static 'bootstrap.min.css' %}"  # right
于 2021-02-05T18:27:06.450 に答える
1

settings.py でコードの一部をインデントしました。

# Uncomment the next line to enable the admin:
     'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    #'django.contrib.admindocs',
     'tinymce',
     'sorl.thumbnail',
     'south',
     'django_facebook',
     'djcelery',
     'devserver',
     'main',

したがって、エラーが発生しています。

于 2020-06-08T16:13:11.583 に答える
1

テンプレート構文エラー: 多くの理由が原因で、そのうちの 1 つは {{ post.date_posted|date: "F d, Y" }} です。コロン (:) と引用符 (") の間のスペースです。スペースを削除すると機能します。このように ..... {{ post.date_posted|date:"F d, Y" }}

于 2020-02-11T06:11:36.510 に答える