Hi there,
in Metronic Django version, once a slash in provided at the urlpattern of urls.py of the project as below:
urlpatterns = [
path('crm/', include('crm.urls')),
]
assets of top right header get 404. If slash is removed, they can be loaded:
urlpatterns = [
path('crm', include('crm.urls')),
]
Hi Hossein Tabar,
Thank you for providing these insights and solutions related to the Metronic Django version. Your observations and troubleshooting steps are valuable for others who might encounter similar issues. We will fix it from our side as well.
Your contributions are appreciated. If you have any more insights or questions in the future, feel free to reach out. Thank you for sharing your experiences to assist the community!
I found the problem and solution.
the problem is that src attributes on the header templates are hard linked to the assets such as:
src = 'media/x.png'
though it should be in django-style:
{% static 'media/x.png' %}
another problem is in the gulp command after npm install. in tools/gulp/helpers.js there is a line:
import {glob} from "glob";
which raise an error during gulp command, changing it back to
import glob from "glob", dismissed the error
Hi,
Thank you for bringing this to our attention. We apologize for any inconvenience this may have caused.
According to the Django documentation (https://docs.djangoproject.com/en/4.2/topics/http/urls/), it is recommended to always add a trailing slash at the end of your URL patterns, unless you have a specific reason not to. For example, it is better to write path('articles/', views.articles) than path('articles', views.articles).
We will check further on this for RTL CSS and fix it.
Regarding the APPEND_SLASH setting, it is already set to True by default in Django.
https://docs.djangoproject.com/en/4.2/ref/settings/#append-slash
Thanks
Also, APPEND_SLASH = True is not working in settings.
p.s, the solution of removing slash solves the problem in LTR version, but not in RTL version (in RTL, version, the assets on the top left header get 404. I couldn't find a solution for RTL.
removing slash from the end of LTR is not a good practice as it creates two different urls, /crm and /crm/