restipie icon indicating copy to clipboard operation
restipie copied to clipboard

Extend instead of Fork

Open gavindsouza opened this issue 3 years ago • 1 comments

As mentioned in the README, this app relies on forking Frappe to get stuff to work. I would suggest doing so by using the Dynamic Pages functionality instead (ref: https://frappeframework.com/docs/v13/user/en/guides/portal-development/context)

You can create a file v1.py and a corresponding base template file v1.html to handle all requests to /v1. The HTML file may be empty.

You can add something that looks like the following under restpie/www/v1.py:

from restipie.restipie import request_handler

def get_context(context):
    return request_handler(context)

gavindsouza avatar Feb 24 '22 14:02 gavindsouza

Very good point, the approach to explicitly modify the app.py in frappe is actually just a workaround since I couldn't see any other way to reroute the request by the time of creating this. I will find time and look into your suggestion, for now I will leave it as is. Thank you!

pifabs avatar Apr 02 '22 14:04 pifabs