﻿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
93	django-admin startproject can create invalid settings/admin.py on windows	xtian@…	Adrian Holovaty	"Following part 2 of the tutorial, I get the following error when trying to view /admin/:

There's been an error:
Traceback (most recent call last):
  File ""C:\play\python\django\trunk\django\core\handlers\wsgi.py"", line 187, in get_response
    response = middleware_method(request, callback, param_dict)
  File ""C:\play\python\django\trunk\django\middleware\admin.py"", line 46, in process_view
    return self.display_login_form(request, message)
  File ""C:\play\python\django\trunk\django\middleware\admin.py"", line 91, in display_login_form
    t = template_loader.get_template(self.get_login_template_name())
  File ""C:\play\python\django\trunk\django\core\template_loader.py"", line 13, in get_template
    return get_template_from_string(load_template_source(template_name))
  File ""C:\play\python\django\trunk\django\core\template_file.py"", line 22, in load_template_source
    raise TemplateDoesNotExist, error_msg
TemplateDoesNotExist: Tried ['C:\\play\\python\\django\trunk\\django/conf/admin_templates\\login.html']

The \t in django\trunk is a tab character.

This is coming from the settings/admin.py file created by django-admin startproject. At line 349 in django-admin.py, where it is populating the TEMPLATE_DIRS setting, the %r format specifier should be used to ensure that the path is rendered correctly into the file, and r needs to be put in the string before it to ensure that it is interpreted as a raw string.

So line 349 should be:

    settings_contents = re.sub(r'(?s)\b(TEMPLATE_DIRS\s*=\s*\()(.*?)\)', ""\\1\n    r%r,\\2)"" % ADMIN_TEMPLATE_DIR, settings_contents)
"	defect	closed	Tools		major	fixed			Design decision needed	0	0	0	0	0	0
