I’m encountering an issue when attempting to display my products on custom pages. I’m using an API for this purpose. Interestingly, when I log in as an admin, I can view my products without any problem. However, if I’m not logged in, the products are not visible. Below is the script I’m currently using:
Traceback (most recent call last):
File "apps/frappe/frappe/website/serve.py", line 18, in get_response
response = renderer_instance.render()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/page_renderers/document_page.py", line 43, in render
html = self.get_html()
^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/utils.py", line 524, in cache_html_decorator
html = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/page_renderers/document_page.py", line 52, in get_html
self.update_context()
File "apps/frappe/frappe/website/page_renderers/document_page.py", line 67, in update_context
ret = self.doc.get_context(self.context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "apps/frappe/frappe/website/doctype/web_page/web_page.py", line 81, in get_context
safe_exec(self.context_script, None, _locals, script_filename=f"web page {self.name}")
File "apps/frappe/frappe/utils/safe_exec.py", line 101, in safe_exec
exec(
File "<serverscript>: web_page_e_liquide", line 18, in <module>
File "<serverscript>: web_page_e_liquide", line 14, in generer_html_articles
NameError: name '_inplacevar_' is not defined
When you attach/upload your images, make sure you mark them as public, not private. They will then be placed in the /public/files directory. This will ensure they are rendered irrespective of who is browsing your website.
You have to amend src=“’ + item.image + '” to the correct path to the public files which is “'files/ + item.image + '”.
Question: Why do you not rather build the page with a Jinja template?