[Fixed]-Getting error with is_popup variable in django 1.9


I was getting the same log message also, with fresh install of django 1.10.6. and logging turned on. I am not an expert on this, but here is what I found out, after asking a question on the Django-users mailing list.

1) It is a DEBUG-message, not an “Error”.

As you can read from the Django logging documentation, the log levels are from the lowest priority to the highest priority

  • DEBUG: Low level system information for debugging purposes
  • INFO: General system information
  • WARNING: Information describing a minor problem that has occurred.
  • ERROR: Information describing a major problem that has occurred.
  • CRITICAL: Information describing a critical problem that has occurred.

This means, it is actually “nice to know” low level information, which you will log if something fails, and you can not find a reason otherwise.

2) It is about a missing template variable.

If you look at the first line of the exception, it says

Exception while resolving variable 'is_popup' in template 'admin/login.html'

The ‘admin/index.html’ extends ‘base_site.html’, which extends ‘base.html’, which has following lines (near the beginning of the file):

<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}"
  data-admin-utc-offset="{% now "Z" %}">

<!-- Container -->
<div id="container">

    {% if not is_popup %}
    <!-- Header -->
    <div id="header">
        <div id="branding">
        {% block branding %}{% endblock %}

You can see from the django logging documentation that missing template variables cause DEBUG level log messages starting from Django 1.9.

3) It is a common pattern to use “undefined” as “false”

The reason for the missing template variable is that django reuses templates. And in some cases, there will be a template variable ‘is_popup’ defined, and django will render the page differently. When there is no such variable as ‘is_popup’, django will skip the associated lines. I.e. undefined and false are identical for comparison purposes inside the template file. Of course you could write code to check if a variable exists, but it would just be extra line of code. Django will skip the undefined variable (some try .. exception pattern inside the core code) anyway.

4) You may suppress these exceptions easily

Just include a logger with name “django.template” to have the log level INFO only.

'loggers': {
    'django': {
        'handlers': ['file'],
        'level': 'DEBUG',
        'propagate': True,
    'django.template': {
        'handlers': ['file'],
        'level': 'INFO',
        'propagate': True,


see SESSION_COOKIE_DOMAIN must match to your domain name or parent domain

# maybe it help too


you should set your project logging level not in debug.set to info can works.

    'loggers': {
    'django': {
        'handlers': ['file', 'console'],
        'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),

        'propagate': True,

see https://github.com/django/django/blob/cfda1fa3f8d95f0f4a369da9021dbd770e5fa44a/django/template/base.py#L911

Leave a comment