Django - template context processors - breaking my app

后端 未结 1 1784
灰色年华
灰色年华 2021-02-13 03:41

I was trying to set up a template context processor like this article mentions so that I could provide information to every template.

I wrote this function in views.py:<

相关标签:
1条回答
  • 2021-02-13 04:09

    Django has a default set of TEMPLATE_CONTEXT_PROCESSORS, which you need to manually add when adding your own. http://docs.djangoproject.com/en/1.3/ref/settings/#template-context-processors

    Depending on your Django version these are different, however if using Django 1.3 you might have something as follows

    TEMPLATE_CONTEXT_PROCESSORS = (
        "django.contrib.auth.context_processors.auth",
        "django.core.context_processors.debug",
        "django.core.context_processors.i18n",
        "django.core.context_processors.media",
        "django.core.context_processors.static",
        "django.contrib.messages.context_processors.messages",
        "Store.views.items_in_cart",
    )
    
    0 讨论(0)
提交回复
热议问题