<ul class="nav nav-pills">
    <li><a href="/">Home</a></li>
    <li><a href="{% url 'layers:index' %}">Layers</a></li>
</ul>

{% if not user.is_authenticated %}
    <h4 class="pull-right">
        <a href="#">Sign-up</a> |
        <a href="{% url 'users:signin' %}">Sign-in</a>
    </h4>
{% else %}
    <h4 class="pull-right">
        Welcome {{ user.username.capitalize }}! |
        <a href="{% url 'users:signout' %}">Sign-out</a>
    </h4>
{% endif %}

<script>
    String.prototype.rsplit = function(sep, maxsplit) {
        var split = this.split(sep);
        return maxsplit ? [ split.slice(0, -maxsplit).join(sep) ].
                                concat(split.slice(-maxsplit)) : split;
    }

    resource = document.location.pathname.rsplit('/',-2);
    if (resource.length > 1) resource = resource[0] + '/';
    $('ul.nav > li > a[href="' + resource + '"]').parent().addClass('active');
</script>

<ul class="nav nav-pills">
    <li><a href="/">Home</a></li>
    <li><a href="{% url 'layers:index' %}">Layers</a></li>
</ul>

{% if not user.is_authenticated %}
    <h4 class="pull-right">
        <a href="#">Sign-up</a> |
        <a href="{% url 'users:login' %}">Sign-in</a>
    </h4>
{% else %}
    <h4 class="pull-right">
        Welcome {{ user.username.capitalize }}! |
        <a href="{% url 'users:logout' %}">Sign-out</a>
    </h4>
{% endif %}

<script>
    String.prototype.rsplit = function(sep, maxsplit) {
        var split = this.split(sep);
        return maxsplit ? [ split.slice(0, -maxsplit).join(sep) ].
                                concat(split.slice(-maxsplit)) : split;
    }

    resource = document.location.pathname.rsplit('/',-2);
    if (resource.length > 1) resource = resource[0] + '/';
    $('ul.nav > li > a[href="' + resource + '"]').parent().addClass('active');
</script>

Fix login link on template
Fix login link on template
