oTree Forum >

Error during template rendering (django's render_bundle not loading css file)

#1 by eshau00

Using otree 3.4.0 and python 3.7.9

When trying to load the template for the first app in my sequence, otree/django has issues with using the CSS file located where the bundle is. The CSS file is not empty and located at the right place and should work (was used in a previous experiment). Here's the error page:

Environment:


Request Method: GET
Request URL: http://localhost:8000/p/01552p1x/first/Opinion/5/

Django Version: 2.2.12
Python Version: 3.7.9
Installed Applications:
['otree',
 'django.contrib.auth',
 'django.forms',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'channels',
 'webpack_loader',
 'rest_framework',
 'rest_framework.authtoken',
 'django_countries',
 'cloudcapturer',
 'django.contrib.humanize',
 'second',
 'first',
 'starter',
 'last',
 'prol',
 'questionnaire']
Installed Middleware:
['otree.middleware.CheckDBMiddleware',
 'otree.middleware.perf_middleware',
 'whitenoise.middleware.WhiteNoiseMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware']


Template error:
In template C:\Users\eshau\Desktop\Summer 2022 Cullen Project\socrates-arnav\first\templates\first\Opinion.html, error at line 11
   expected string or bytes-like object
   1 : {% extends "global/FullPage.html" %}
   2 : {% load otree static %}
   3 : {% load render_bundle from webpack_loader %}
   4 : {% block title %}
   5 : 
   6 : {% endblock %}
   7 : 
   8 : {% block body_main %}
   9 :     {#    TODO: add <div>ERRORS: {{ form.errors.as_json|default_if_none:'' }}</div> #}
   10 :     <link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet">
   11 :      {% render_bundle 'no_chat' 'css' %} 
   12 :     {% render_bundle 'chunk-vendors' 'css' %}
   13 :     <script>
   14 :         window.original_ego_answer = {{ player.original_ego_answer|default_if_none:False|json }}
   15 :         window.socket_path = "{{ view.live_url }}";
   16 :         window.id_in_group = {{ player.id_in_group }};
   17 :         window.path_to_vignette = "{% url 'get_current_vignette' participant_code=participant.code %}";
   18 :         window.djangoErrors = {{ django_errors|default_if_none:''|json }};
   19 :     </script>
   20 : 
   21 :     <form action='' method="post" role="form" id="form" autocomplete="off">


Traceback:

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\otree\views\abstract.py" in dispatch
  199.                     response.render()

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\response.py" in render
  106.             self.content = self.rendered_content

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\response.py" in rendered_content
  83.         content = template.render(context, self._request)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\backends\django.py" in render
  61.             return self.template.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\base.py" in render
  171.                     return self._render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\base.py" in _render
  163.         return self.nodelist.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\base.py" in render
  937.                 bit = node.render_annotated(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\otree\strict_templates.py" in render_annotated
  103.             return self.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\loader_tags.py" in render
  150.             return compiled_parent._render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\base.py" in _render
  163.         return self.nodelist.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\base.py" in render
  937.                 bit = node.render_annotated(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\otree\strict_templates.py" in render_annotated
  103.             return self.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\loader_tags.py" in render
  62.                 result = block.nodelist.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\base.py" in render
  937.                 bit = node.render_annotated(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\otree\strict_templates.py" in render_annotated
  103.             return self.render(context)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\django\template\library.py" in render
  192.         output = self.func(*resolved_args, **resolved_kwargs)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\webpack_loader\templatetags\webpack_loader.py" in render_bundle
  24.         attrs=attrs, is_preload=is_preload)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\webpack_loader\utils.py" in get_as_tags
  71.     bundle = _get_bundle(loader, bundle_name, extension)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\webpack_loader\utils.py" in _get_bundle
  47.     bundle = loader.get_bundle(bundle_name)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\webpack_loader\loader.py" in get_bundle
  116.             filtered_chunks = self.filter_chunks(chunks)

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\webpack_loader\loader.py" in filter_chunks
  59.                          for regex in self.config['ignores'])

File "c:\users\eshau\appdata\local\programs\python\python37\lib\site-packages\webpack_loader\loader.py" in <genexpr>
  59.                          for regex in self.config['ignores'])

Exception Type: TypeError at /p/01552p1x/first/Opinion/5/
Exception Value: expected string or bytes-like object

Write a reply

Set forum username