arthur.00
arthur.00

Reputation: 175

Why is Django missing the custom context processor?

My django 1.6 project is structured:

cont_proc.py reads:

from django.conf import settings

def misc(request):
    return {'SITE_URL': settings.SITE_URL,'BALANCED_API_KEY':settings.BALANCED_API_KEY}`

in settings.py I have:

import django.conf.global_settings as DEFAULT_SETTINGS
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (       os.path.join(BASE_DIR, 'cg1.cont_proc.misc'),)
BALANCED_API_KEY = os.environ.get('BALANCED_API_KEY')
SITE_URL = 'www.mysite.com'  #but set up

python manage.py shell:

>>> from django.conf import settings
>>> settings.TEMPLATE_CONTEXT_PROCESSORS
['django_balanced.context_processors.balanced_library','django_balanced.context_processors.balanced_settings', 'django.contrib.auth.context_processors.auth']

>>>>import os
>>>>os.environ.get('BALANCED_API_KEY')
'correct key from a local .env file'

I've tried quite a few so question, especially: Where is template context processor in Django 1.5?

also: Python/Django is importing the wrong module (relative when it should be absolute)

but django doesn't seem to see my custom context processor, cont_proc, in the shell. And when I use render in views my templates do not receive the variables.

Upvotes: 0

Views: 150

Answers (1)

arthur.00
arthur.00

Reputation: 175

I had installed django-balanced. Apparently this was a mistake. I removed from installed apps and all was good.

Upvotes: 1

Related Questions