I want to create a individual web page for members and send a link with uuid like:
https://example.com/app/262976c7-5c9a-46c4-a775-bbad186e
Link will be unique and every member can view their data. Is it possible with "route" (or any other way)?
If all the pages are served via a single controller action, with the UUID serving as a URL arg (i.e., the first segment of the URL path after the controller function), then you can hide the controller and function part of the URL via the rewrite system. The routes.py file could contain something like this:
routers = dict(
BASE = dict(
default_controller = 'default',
default_function = 'index',
functions = ['index', 'action1', 'action2']
)
)
The above router will hide the default controller and function from URLs, so instead of:
https://example.com/app/default/index/262976c7-5c9a-46c4-a775-bbad186e
you will have:
https://example.com/app/262976c7-5c9a-46c4-a775-bbad186e
Note, it is important for the functions
key in the router to include the list of all functions in the default.py controller so the router can distinguish between function names and URL args, which enables the default function (i.e., index
) to be hidden from the URL when there is a URL arg present.
For more details about the router, see the example routes.py.
In the default.py controller, the index
function would serve the pages based on the first URL arg:
def index():
uuid = request.args(0)
[fetch user specific data based on uuid]
return dict(...)