When a user is not logged in and attempts to access the login page with debug mode enabled, the file "base.html" throws an exception claiming that "search_form" is not an attribute of the global "g" object. It appears this was being caused by "search_form" only being defined for "g" if the user is authenticated. Moved attribute declaration out of if clause.