Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

bug report: in Metronic Django, with slash in urls conf, some assets get 404


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')),
]


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


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/



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



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 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!


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(