Closed xAlexo closed 13 years ago
Can you provide full stack trace?
Traceback: File "C:\Program Files\Python2\lib\site-packages\django\core\handlers\base.py" in get_response
Exception Type: TemplateSyntaxError at / Exception Value: Caught KeyError while rendering: 'request'
Do you have 'django.core.context_processors.request' in your TEMPLATE_CONTEXT_PROCESSORS?
added to settings.py
TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.request", "django.core.context_processors.i18n", "django.core.context_processors.media", "django.core.context_processors.static", "django.contrib.messages.context_processors.messages" )
and go to
Попробовал создать чистый проект, тоже самое.
Вобщем проблема была во view, проблема чисто новичков, поэтому хорошо бы добавить пример :)
В чем именно была проблема? При рендере шаблона не отдавался RequestContext?
ага
Ок, допишу в документацию.
Для тех, кто в дальнейшем столкнётся с этой проблемой - нужно добавить 'django.core.context_processors.request' в TEMPLATE_CONTEXT_PROCESSORS.
TemplateSyntaxError at /
Caught KeyError while rendering: 'request'
Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.3 Exception Type: TemplateSyntaxError Exception Value:
Caught KeyError while rendering: 'request'
Exception Location: C:\Program Files\Python2\lib\site-packages\django\template\context.py in getitem, line 60 Python Executable: C:\Program Files\Python2\python.exe Python Version: 2.7.1
Template error
In template *, error at line 61 Caught KeyError while rendering: 'request' 57 {% load loginza_widget %} 58 {% if user.is_authenticated %} 59 Добро пожаловать, {{ user }} 60 {% else %} 61 {% loginza_button "Войти через loginza" %} 62 {% endif %}