Web Generator for ERPnext7

Hi all,

It seems that there is a change make to ERPnext 7 for Website Generator.
In the previous version, I was following this site (https://frappe.github.io/frappe/user/en/guides/portal-development/generators.html) to generate webpages.

However in the new version, I noticed that only route field is required in the doctype and despite following the same steps and format, I am able to have the show in website link. But upon clicking on the link, it shows the following error:

My chart2.html is placed within the custom module’s folder:

Please advice!
Thank you. :slight_smile:

Traceback (most recent call last):
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/render.py”, line 32, in render
data = render_page_by_language(path)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/render.py”, line 101, in render_page_by_language
return render_page(path)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/render.py”, line 117, in render_page
return build(path)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/render.py”, line 124, in build
return build_page(path)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/render.py”, line 137, in build_page
context = get_context(path)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/context.py”, line 19, in get_context
context = build_context(context)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/website/context.py”, line 62, in build_context
module = frappe.get_module(context.controller)
File “/home/frappe/benches/sunseap-dev/apps/frappe/frappe/init.py”, line 643, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
ImportError: No module named www.chart2

add a file __init__.py to your www directory

Hi @revant_one,

After adding __init__.py to the directory, I received this error.

This is my own code in the python file.

How can I resolve this?
Thanks! :slight_smile:

Don’t think you have to whitelist get_context

try printing doc, check if it has values?

Share source code for further help.

context.doc is none.

Hey @revant_one and @rmehta,

Just a quick overview of what I have done in ERPnext ver 6.

I have created these files under a custom app (organisational_managment)

My understanding is that the python file is the one retreiving the data and placing into context. Here is my code:

Then this data will be display inside html file.

Data pulled in from a custom doctype called Positions.
This way of pulling data and also calling context.doc works in ERPnext ver 6. But replicating this in ERPnext 7 is not working.

Would you be able to kindly help me in this?

@jlsy can you share your app repo?

1 Like