﻿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
25570	Using a templatetag in a Python file in a project template causes an Exception	Daniel Finch	nobody	"If you have a Python file in your project template and you have a string of code such as {{{ {% static %} }}}, startproject will throw an exception as it tries to render the tag.

As a minimum viable test case, I put together the following repository: https://github.com/danielsamuels/django-project-template-bug
It consists of a single {{{ __init__.py }}}  with a comment inside, the contents of the comment being {{{ {% static %} }}}. Using this as a project template will cause the following exception to be thrown:

{{{ django-admin startproject output --template https://github.com/danielsamuels/django-project-template-bug/archive/master.zip }}}

{{{
Traceback (most recent call last):
  File ""/Users/danielsamuels/Workspace/testing/.venv/bin/django-admin"", line 11, in <module>
    sys.exit(execute_from_command_line())
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/core/management/__init__.py"", line 351, in execute_from_command_line
    utility.execute()
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/core/management/__init__.py"", line 343, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/core/management/base.py"", line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/core/management/base.py"", line 445, in execute
    output = self.handle(*args, **options)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/core/management/commands/startproject.py"", line 33, in handle
    super(Command, self).handle('project', project_name, target, **options)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/core/management/templates.py"", line 151, in handle
    template = Engine().from_string(content)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/template/engine.py"", line 153, in from_string
    return Template(template_code, engine=self)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/template/base.py"", line 190, in __init__
    self.nodelist = engine.compile_string(template_string, origin)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/template/engine.py"", line 261, in compile_string
    return parser.parse()
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/template/base.py"", line 339, in parse
    self.invalid_block_tag(token, command, parse_until)
  File ""/Users/danielsamuels/Workspace/testing/.venv/lib/python2.7/site-packages/django/template/base.py"", line 395, in invalid_block_tag
    raise self.error(token, ""Invalid block tag: '%s'"" % command)
django.template.base.TemplateSyntaxError: Invalid block tag: 'static'
}}}

In theory, this project template _should_ work, given that the templatetag is just a comment within the project."	Bug	closed	Utilities	1.8	Normal	wontfix		daniel.samuels1@…	Unreviewed	0	0	0	0	0	0
