I can't load javascript and css #154
-
Hi, I am trying to configure the components.py and I have tried everything in the Media class, but I can't get the css and js to load. My app path is like this: apps/app_name/components.py I have tried many combinations but none have worked. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 12 replies
-
Hi! Unfortunately there is not enough information in you question to tell you where things have gone wrong. The recommended location is '[your app]/components/calendar/calendar.css' and '[your app]/components/calendar/calendar.js', and that you point to those locations in your Media class. Does this not work? |
Beta Was this translation helpful? Give feedback.
-
I added this on components.py: |
Beta Was this translation helpful? Give feedback.
-
Hi there, Where are your JS/CSS files located when you run |
Beta Was this translation helpful? Give feedback.
-
I don't have much idea about static, what command should I execute? I put collectstatic and it warned me that it is going to rewrite the existing files. I am only using the basic static folder in the root of the server. |
Beta Was this translation helpful? Give feedback.
-
Because I literally tried out the readme yesterday, so my memory is still fresh. This is my Django project layout.Here's the github repo https://github.com/GreenDeploy-io/example-django-using-hypercomponents
I created my https://github.com/GreenDeploy-io/example-django-using-hypercomponents/tree/main/hypercomponents Please make sure your setup is as such. Next, make sure Once I added this in, things work for me. Looking at your path |
Beta Was this translation helpful? Give feedback.
-
@JMorell I've released a new version of django_components and updated the README with better instructions. Can you get it working now? |
Beta Was this translation helpful? Give feedback.
-
Hey @EmilStenstrom this happens for me too. I still have my custom project structure but using the separated component approach now. Event though I have the load tag for component js dependencies in my template |
Beta Was this translation helpful? Give feedback.
-
Marking this one as completed as it's quite old already, and the issue shouln't be present anymore. If you have similar issues with newer versions, please open a new discussion / issue. |
Beta Was this translation helpful? Give feedback.
Marking this one as completed as it's quite old already, and the issue shouln't be present anymore. If you have similar issues with newer versions, please open a new discussion / issue.