tetra-framework / tetra

Tetra - A full stack component framework for Django using Alpine.js
https://www.tetraframework.com
MIT License
570 stars 19 forks source link

Component "<component_name>" not found. Available components are: [] #83

Closed m5no0p closed 3 weeks ago

m5no0p commented 3 weeks ago

I have this error in my browser: Component "tags_list" not found. Available components are: []

Screenshot_5

and my component is like this:


from tetra import Component, public, Library
from todo.models import Tag

default = Library()

@default.register
class TagsList(Component):
    name = public("")
    color = public("indigo")

    def load(self):
        self.tags = Tag.objects.all()

    @public
    def add_todo(self, name, color):
        tag = Tag(
            name=name,
            color=color,
        )
        tag.save()
        self.name = ""

    template_name = "todo/components/multi-select-or-create.html"
nerdoc commented 3 weeks ago

At the first glance, as there are "no" components available (empty list) it seems to me that your "components" module is not loaded. could it be that there is a syntax error anywhere in your components.py file, so that the automatic import does not succeed? Then NO components are available. Is your app (that contains the components.py) included in INSTALLED_APPS? Is this your complete components.py?

nerdoc commented 3 weeks ago

@m5no0p is this still a problem? Or can I close this issue?

m5no0p commented 3 weeks ago

it was my bad...i didn't install sourcetypes package.

Screenshot_10 Screenshot_11

nerdoc commented 2 weeks ago

Glad that it worked. sourcetypes is not really an obligate requirement of tetra. It just helps you / your IDE to recognize that type of language. So I didn't make tetra depend on it.