Adding a CMS to Your Pyramid Web App Transcripts
Chapter: Advanced Markdown templates
Lecture: markdown-subtemplates

Login or purchase this course to watch this video and the rest of the course contents.
0:00 to solve all those problems that we talked about and actually do a whole lot more. We're gonna use this library called markdown sub template.
0:08 The idea is that this lets us take standard mark out and treated like these more advanced template ing languages, Jinja or Chameleon from the Web.
0:18 And we're gonna be able to plug that right into our website. So it's super easy ideas.
0:23 We have some markdown content when I feed it possibly into a larger piece, right? This these pieces down here might be those subtitles in the high d.
0:31 P I. And here's the overall landing page. Feed that in a pyramid number into our shared lay out our CMS page PT and then render it over to the browser.
0:43 It is all sorts of cool stuff. It does the cashing.
0:45 It integrates with databases with a little bit of help from us, and it even has cool extensions for logging and specialized cashing and so on.
0:54 Okay, so what we're gonna need to do, he's good into this extensive bility section. Now, by default, it loads the contents from disk.
1:03 And if you don't do anything you want to save marked on files to a file and have them rendered as if it were Seamus.
1:09 Well, you're good to co that already exist. There's no problem. But what we need to do how is have it will integrate with the database.
1:15 So if we come over here and look roll down a little bit, you can see that we have to do is just define some way to store our mark down in the database.
1:25 And guess what? We've already done that it's called a page. We're doing that now, though, that's done.
1:30 But then we've got to implement a few methods, like given ah path or your l give us the markdown from.
1:36 Basically, this library doesn't know the connection string to your database or that you're even using sequel Commie.
1:43 You could be using something else so it doesn't know how you're doing that, and basically, our job is to do a tiny bit of work to make that happen, both for standard mark down.
1:52 And then we could have these imported shared elements that we could treat potentially differently.
1:58 For example, you might not want to let people directly request the shared content, but only use it for stuff that's allowed to be imported, but not actually directly requested.
2:08 Okay, so we're gonna use this library markdown sub template.
2:12 So we're gonna put that into our project, do this little bit of integration here, and we should be good to go.

Talk Python's Mastodon Michael Kennedy's Mastodon