viper-framework / viper-web

BSD 3-Clause "New" or "Revised" License
8 stars 9 forks source link

ERROR: django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registered tag library #8

Closed icepaule closed 4 years ago

icepaule commented 4 years ago

Hello viper-team,

could you please help with this issue raised right after a fresh install? After login to viper, a 500-Error apears and wont let me do any further action. Nevertheless, the login to the admin works fine...

Thanks a lot for the help and more thanks for giving us such a great tool .... :-)

Cheers Marcus

_2020-10-03 13:37:16 - django.request - ERROR - log.py:228 - Internal Server Error: / Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py", line 1021, in find_library return parser.libraries[name] KeyError: 'staticfiles'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.6/dist-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, *kwargs) File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/mixins.py", line 52, in dispatch return super().dispatch(request, args, kwargs) File "/usr/local/lib/python3.6/dist-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/opt/viper/viper/web/viperweb/views.py", line 310, in get 'projects': get_project_list()}) File "/usr/local/lib/python3.6/dist-packages/django/shortcuts.py", line 19, in render content = loader.render_to_string(template_name, context, request, using=using) File "/usr/local/lib/python3.6/dist-packages/django/template/loader.py", line 61, in render_to_string template = get_template(template_name, using=using) File "/usr/local/lib/python3.6/dist-packages/django/template/loader.py", line 15, in get_template return engine.get_template(template_name) File "/usr/local/lib/python3.6/dist-packages/django/template/backends/django.py", line 34, in get_template return Template(self.engine.get_template(template_name), self) File "/usr/local/lib/python3.6/dist-packages/django/template/engine.py", line 143, in get_template template, origin = self.find_template(template_name) File "/usr/local/lib/python3.6/dist-packages/django/template/engine.py", line 125, in find_template template = loader.get_template(name, skip=skip) File "/usr/local/lib/python3.6/dist-packages/django/template/loaders/cached.py", line 53, in get_template template = super().get_template(template_name, skip) File "/usr/local/lib/python3.6/dist-packages/django/template/loaders/base.py", line 30, in get_template contents, origin, origin.template_name, self.engine, File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 156, in init self.nodelist = self.compile_nodelist() File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 194, in compile_nodelist return parser.parse() File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py", line 266, in do_extends nodelist = parser.parse() File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/usr/local/lib/python3.6/dist-packages/django/template/loader_tags.py", line 209, in do_block nodelist = parser.parse(('endblock',)) File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 477, in parse raise self.error(token, e) File "/usr/local/lib/python3.6/dist-packages/django/template/base.py", line 475, in parse compiled_result = compile_func(self, token) File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py", line 1072, in load lib = find_library(parser, name) File "/usr/local/lib/python3.6/dist-packages/django/template/defaulttags.py", line 1025, in find_library name, "\n".join(sorted(parser.libraries)), django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls bootstrap cache debugger_tags highlighting i18n indent_text l10n log rest_framework static syntax_color truncate_letters tz viper_templatetags widont 2020-10-03 13:37:16 - django.server - ERROR - basehttp.py:157 - "GET / HTTP/1.1" 500 5411

frennkie commented 4 years ago

I currently don't have a test environment ready. But most likely there are two places were {% load static from staticfiles %} needs to be changed to {% load static %}:

Would you be able to test this and give feedback?

icepaule commented 4 years ago

Excellent, that was the trick....

Here, where I changed:

grep -R "load static" * viper/web/viperweb/templates/base.html: {% load static %} viper/web/viperweb/templates/rest_framework_swagger/index.html: {% load static from static %}

Thaaanks so much for your help. ;-)

frennkie commented 4 years ago

Could you place a PR?

icepaule commented 4 years ago

Sure, but what does "PR" mean? (Sorry)

frennkie commented 4 years ago

Well, PR means Pull Request... :-)

Adding a code change proposal that fixes this everyone. But nevermind.. I'll handle it.

icepaule commented 4 years ago

Thx again... :-)

frennkie commented 4 years ago

fixed by #3