Home Features Philosophy Docs Blog Errors Security Examples FAQ
DJE-040 Error Template

Missing template_name on LiveView

Error message

ImproperlyConfigured: LiveView requires a template_name attribute

Every LiveView subclass must define a template_name attribute pointing to the template file that renders the view's HTML. Without it, djust cannot render the initial page or subsequent updates.

config liveview template

Affected versions: >=0.2.0

Solution

Before (problematic)
from djust import LiveView

class CounterView(LiveView):
    # Missing template_name!
    count = 0

    def handle_event(self, event, params):
        if event == "increment":
            self.count += 1
After (fixed)
from djust import LiveView

class CounterView(LiveView):
    template_name = "counter.html"
    count = 0

    def handle_event(self, event, params):
        if event == "increment":
            self.count += 1