﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
9941	{% url ... %} template tag may fail when not using a settings module	Simon Sapin	nobody	"When using django.conf.settings.configure(...) instead of a settings module as [http://docs.djangoproject.com/en/dev/topics/settings/#using-settings-without-setting-django-settings-module documented], settings.SETTINGS_MODULE is set to None.

The {% url ... %} template tag is implemented as following, in django.template.defaulttags.URLNode.render :
{{{
        # Try to look up the URL twice: once given the view name, and again
        # relative to what we guess is the ""main"" app. If they both fail, 
        # re-raise the NoReverseMatch unless we're using the 
        # {% url ... as var %} construct in which cause return nothing.
        url = ''
        try:
            url = reverse(self.view_name, args=args, kwargs=kwargs)
        except NoReverseMatch:
            project_name = settings.SETTINGS_MODULE.split('.')[0]
            try:
                url = reverse(project_name + '.' + self.view_name,
                              args=args, kwargs=kwargs)
            except NoReverseMatch:
                if self.asvar is None:
                    raise
}}}

In some cases (for example in the admin templates), it will execute this : '''settings.SETTINGS_MODULE.split('.')''' which raises '''!AttributeError: '!NoneType' object has no attribute 'split''''.
Instead, it should check for settings.SETTINGS_MODULE being None before using it.

As a workaround, set SETTINGS_MODULE to some module name. This module needs to exist, as it is imported by other parts of Django, but does not need to actually contain the settings (which are set with django.conf.settings.configure)
"		closed	Template system	1.0		duplicate			Unreviewed	0	0	0	0	0	0
