December 2018
Beginner to intermediate
404 pages
10h 14m
English
Let's make this even more interesting, and create our own simple CMS. For this, we can have the route expect a template name (a page) in the URL and then just render it. We could then dynamically create web pages and have them served by our CMS.
It turns out that this is really easy to do:
@http.route('/hellocms/<page>', auth='public')
def hello(self, page, **kwargs):
return http.request.render(page)
The page argument should match a Template External ID. If you open http://localhost:8069/hellocms/library_website.helloworld in your web browser, you should see our Hello World web page.
In fact, the built-in website module provides CMS features, including a more robust implementation of this, at the /page endpoint route.
In
Read now
Unlock full access