Comments (8)
Thank you @liquidiert.
Yes, this looks like something to do with the way the project is structured. I'll try to look at it, but I have limited time these days, so might take a while.
from django-components.
@liquidiert could you provide a sample repo that reproduces this error? It works for me
hot_reloading_django_5.0.4.mp4
from django-components.
@dylanjcastillo Created a repository. I suspect it has smth to do with the cookiecutter template used. I understand if it's not on your roadmap to support custom stuff like this :) But still might be interesting
from django-components.
@liquidiert Would you mind trying your repo with the latest version of django-components, and enable logging? You'll see the full list of paths that are searched for which might give a hint of what the problem is.
from django-components.
@EmilStenstrom I've updated django-components to 0.66
and turned on logging. Unfortunately I can't see the full list of search paths you mentioned. Do I have to set up smth else for that?
from django-components.
Hey @liquidiert,
I researched this a bit today. It seems to be a caching issue related to Django's cached.Loader
. For some reason, in your project configuration, it doesn't restart the server when you change single file components. It occurs when you add django-component
's template_loader.Loader
to the loaders but I couldn't figure out why (and I don't have enough knowledge about this topic).
There's a workaround you could use (though I didn't test it thoroughly). Only add django_components.template_loader.Loader
when DJANGO_DEBUG=FALSE
:
# In commons.py
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [
# Contains plain text templates, like `robots.txt`:
BASE_DIR
/ "templates",
],
"OPTIONS": {
"context_processors": [
# Default template context processors:
"django.contrib.auth.context_processors.auth",
"django.template.context_processors.debug",
"django.template.context_processors.i18n",
"django.template.context_processors.media",
"django.contrib.messages.context_processors.messages",
"django.template.context_processors.request",
],
"loaders": [
(
"django.template.loaders.cached.Loader",
[
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
# "django_components.template_loader.Loader", <- Remove this
],
)
],
"builtins": [
"django_components.templatetags.component_tags",
],
},
}
]
## Append to loaders if not DEBUG
if not DEBUG:
TEMPLATES[0]["OPTIONS"]["loaders"][0][1].append("django_components.template_loader.Loader")
I hope that helps!
from django-components.
Hey @dylanjcastillo that is really weird. But thanks for the workaround!
from django-components.
The cached loader shouldn't be used when developing. It makes sense that changes within templates that are cached are not reloaded. Great find Dylan, I'm closing this.
from django-components.
Related Issues (20)
- Tests refactor: Move from template files to inline templates HOT 2
- Define public API HOT 1
- template_loader blocks on STATICFILES_DIRS if there are tuples HOT 1
- Allow to render component dependencies without middleware HOT 24
- Feature parity with Juro's fork HOT 1
- Topic on new behaviour for dispatching slots using 'include' tags HOT 2
- Better support for AlpineJS HOT 5
- Scoped slots - Passing data to slots and accessing them in fills HOT 20
- Revert back to "django" as the default setting for "context_behavior"
- Refactor accessing of default slot from `as var` to kwarg HOT 3
- '
- Bug: Cannot override `block` tag inside `component` tag inside a template imported via `extends` in "django" mode HOT 2
- Support for dynamically loading component's JS/CSS dependencies HOT 2
- Typo Preventing html_attrs defaults from working HOT 2
- Inline tests/templates to make tests easier to follow HOT 1
- Allow to render a component, passing args and kwargs, from Python HOT 3
- Support for Paths as objects is missing HOT 25
- Allow users to customize component tags + reintroduce component "inline" block HOT 3
- This hyperlink is dead - There is no "Registering Components" in latest readme (0.82) HOT 2
- safer_staticfiles working? HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-components.