diff --git a/README.md b/README.md index d558c57c..ccb33808 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,9 @@ Now you need a Django template for your component. Feel free to define more vari
Today's date is {{ date }}
``` -Finally, we use django-components to tie this together. We create a Component by inheriting from the Component class and specifying the context method. We also register the global component registry so that we easily can render it anywhere in our templates. +Finally, we use django-components to tie this together. Start by creating a file called `components.py` in any of your apps. It will be auto-detected and loaded by the app. + +Inside this file we create a Component by inheriting from the Component class and specifying the context method. We also register the global component registry so that we easily can render it anywhere in our templates. ```python from django_components import component @@ -255,6 +257,20 @@ NOTE: `{% csrf_token %}` tags need access to the top-level context, and they wil Components can also access the outer context in their context methods by accessing the property `outer_context`. +# Configuring the library location + +If you want to, you can configure the location where components are loaded. To do this, add a COMPONENTS variable to you settings.py with a list of libraries to look for. This allows you to build a structure of components that are independent from your apps. + +```python +COMPONENTS = { + "libraries": [ + "mysite.components.forms", + "mysite.components.buttons", + "mysite.components.cards", + ] +} +``` + # Running the tests To quickly run the tests install the local dependencies by running