Hi,

Do you have more of your traceback?

Are you sure this is your "home" view that's being called?

Is this happening in an included template?

Collin

On Saturday, December 20, 2014 3:27:00 PM UTC-6, Alexandre Provencio wrote:
>
> Hello all, this is a cross post i made on stackoverflow 
>
> http://stackoverflow.com/questions/27503581/yet-another-custom-templatetag-raising-keyerror-when-debug-false
>  
>
> I'm trying to use a custom templatetag (this one actually: 
> https://djangosnippets.org/snippets/2875/), on my project which works 
> fine as long as DEBUG=True. When it's False, the relevant error part 
> is: 
>
> File "...app/templatetags/helper_tags.py", line 15, in change_lang 
> path = context['request'].path 
> File "...local/lib/python2.7/site-packages/django/template/context.py", 
> line 56, in __getitem__ 
> raise KeyError(key) 
> KeyError: 'request' 
>
> I've seen a lot of questions like this and I have already done the 
> settings that all of them seen to suggest which are: 
>
> 1) views.py uses django.shortcuts.render: 
>
> from django.shortcuts import render 
> def home(request): 
>     return render(request, 'home.html') 
>
> 2) settings.py contains: 
>
> ALLOWED_HOSTS = ['*'] 
>
> from django.conf import global_settings 
> TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS 
> + ( 
>     "django.core.context_processors.request", 
> ) 
>
> I've also created a new project with the same Django version (1.6.2) 
> that tries to imitate the problematic project as much as possible, and 
> for my despair it works fine also when DEBUG=False. 
>
> Any hints on this is very much appreciated. 
>
> Cheers! 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e1236721-cc22-4554-82b6-ddb2a9d068e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to