Opened 5 years ago
Closed 5 years ago
#31379 closed Bug (worksforme)
Admin login page is broken after using django-admin startproject.
Reported by: | Per-Andre Stromhaug | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 3.0 |
Severity: | Normal | Keywords: | admin, login, static, staticfiles, template, templates |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The error I'm seeing is:
django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 4: 'static', expected 'endblock'. Did you forget to register or load this tag?
Steps to reproduce:
pip install django==3.0.4 django-admin startproject test_project cd test_project ./manage.py migrate ./manage.py runserver
Then go to localhost:8000/admin
Full stack trace:
Internal Server Error: /admin/login/ Traceback (most recent call last): File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 469, in parse compile_func = self.tags[command] KeyError: 'static' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 145, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 143, in _get_response response = response.render() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/response.py", line 105, in render self.content = self.rendered_content File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/response.py", line 81, in rendered_content template = self.resolve_template(self.template_name) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/response.py", line 63, in resolve_template return select_template(template, using=self.using) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loader.py", line 42, in select_template return engine.get_template(template_name) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 34, in get_template return Template(self.engine.get_template(template_name), self) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/engine.py", line 143, in get_template template, origin = self.find_template(template_name) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/engine.py", line 125, in find_template template = loader.get_template(name, skip=skip) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loaders/base.py", line 30, in get_template contents, origin, origin.template_name, self.engine, File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 156, in __init__ self.nodelist = self.compile_nodelist() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 194, in compile_nodelist return parser.parse() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 266, in do_extends nodelist = parser.parse() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 209, in do_block nodelist = parser.parse(('endblock',)) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 471, in parse self.invalid_block_tag(token, command, parse_until) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 527, in invalid_block_tag get_text_list(["'%s'" % p for p in parse_until], 'or'), django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 4: 'static', expected 'endblock'. Did you forget to register or load this tag? 2020-03-18 18:48:57,888 django.request [ERROR] Internal Server Error: /admin/login/ Traceback (most recent call last): File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 469, in parse compile_func = self.tags[command] KeyError: 'static' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 145, in _get_response response = self.process_exception_by_middleware(e, request) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 143, in _get_response response = response.render() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/response.py", line 105, in render self.content = self.rendered_content File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/response.py", line 81, in rendered_content template = self.resolve_template(self.template_name) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/response.py", line 63, in resolve_template return select_template(template, using=self.using) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loader.py", line 42, in select_template return engine.get_template(template_name) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/backends/django.py", line 34, in get_template return Template(self.engine.get_template(template_name), self) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/engine.py", line 143, in get_template template, origin = self.find_template(template_name) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/engine.py", line 125, in find_template template = loader.get_template(name, skip=skip) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loaders/base.py", line 30, in get_template contents, origin, origin.template_name, self.engine, File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 156, in __init__ self.nodelist = self.compile_nodelist() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 194, in compile_nodelist return parser.parse() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 266, in do_extends nodelist = parser.parse() File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/loader_tags.py", line 209, in do_block nodelist = parser.parse(('endblock',)) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 471, in parse self.invalid_block_tag(token, command, parse_until) File "/Users/perandre/code/mailia/venv/lib/python3.7/site-packages/django/template/base.py", line 527, in invalid_block_tag get_text_list(["'%s'" % p for p in parse_until], 'or'), django.template.exceptions.TemplateSyntaxError: Invalid block tag on line 4: 'static', expected 'endblock'. Did you forget to register or load this tag?
Change History (1)
comment:1 by , 5 years ago
Easy pickings: | unset |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
Summary: | Admin login page is broken after using django-admin startproject → Admin login page is broken after using django-admin startproject. |
Note:
See TracTickets
for help on using tickets.
Django 3.0.4 works for me. Please use one of support channels.